+ if (compressed && do_compress) {
+ comp_buf->length = bufsize;
+ worklen = TP_BSIZE + writesize;
+ compresult = 1;
+#ifdef HAVE_ZLIB
+ if (zipflag == COMPRESS_ZLIB) {
+ compresult = compress2(comp_buf->buf,
+ &worklen,
+ (char *)slp->tblock[0],
+ writesize,
+ compressed);
+ if (compresult == Z_OK)
+ compresult = 1;
+ else
+ compresult = 0;
+ }
+#endif /* HAVE_ZLIB */
+#ifdef HAVE_BZLIB
+ if (zipflag == COMPRESS_BZLIB) {
+ unsigned int worklen2 = worklen;
+ compresult = BZ2_bzBuffToBuffCompress(
+ comp_buf->buf,
+ &worklen2,
+ (char *)slp->tblock[0],
+ writesize,
+ compressed,
+ 0, 30);
+ worklen = worklen2;
+ if (compresult == BZ_OK)
+ compresult = 1;
+ else
+ compresult = 0;
+ }
+
+#endif /* HAVE_BZLIB */
+#ifdef HAVE_LZO
+ if (zipflag == COMPRESS_LZO) {
+ lzo_uint worklen2 = worklen;
+ compresult = lzo1x_1_compress((char *)slp->tblock[0],writesize,
+ comp_buf->buf,
+ &worklen2,
+ LZO_WorkMem);
+ worklen = worklen2;
+ if (compresult == LZO_E_OK)
+ compresult = 1;
+ else
+ compresult = 0;
+ }
+#endif /* HAVE_LZO */
+ if (compresult && worklen <= ((unsigned long)writesize - 16)) {
+ /* write the compressed buffer */
+ comp_buf->length = worklen;
+ comp_buf->compressed = 1;
+ buffer = (char *) comp_buf;
+ returns.clen = bufsize = worklen + sizeof(struct tapebuf);
+ }
+ else {
+ /* write the data uncompressed */
+ comp_buf->length = writesize;
+ comp_buf->compressed = 0;
+ buffer = (char *) comp_buf;
+ returns.clen = bufsize = writesize + sizeof(struct tapebuf);
+ returns.unclen = returns.clen;
+ memcpy(comp_buf->buf, (char *)slp->tblock[0], writesize);
+ }
+ }
+ /* compress the remaining blocks if we're compressing */
+ do_compress = compressed;
+#endif /* HAVE_ZLIB || HAVE_BZLIB || HAVE_LZO */
+
+ if (sigsetjmp(jmpbuf2, 1) == 0) {
+ ready2 = 1;
+ if (!caught2)
+ sigsuspend(&set);
+ }
+ ready2 = 0;
+ caught2 = 0;
+
+#ifdef USE_QFA
+ if (gTapeposfd >= 0) {
+ int i;
+ int foundone = 0;
+
+ for (i = 0; (i < ntrec) && !foundone; ++i) {
+ uspclptr = (union u_spcl *)&slp->tblock[i];
+ spclptr = &uspclptr->s_spcl;
+ if ((spclptr->c_magic == NFS_MAGIC) &&
+ (spclptr->c_type == TS_INODE) &&
+ (spclptr->c_date == gThisDumpDate) &&
+ !(spclptr->c_dinode.di_mode & S_IFDIR) &&
+ !(spclptr->c_flags & DR_EXTATTRIBUTES)
+ ) {
+ foundone = 1;
+ /* if (cntntrecs >= maxntrecs) { only write every maxntrecs amount of data */
+ cntntrecs = 0;
+ if (gtperr == 0)
+ gtperr = GetTapePos(&curtapepos);
+ /* if an error occured previously don't
+ * try again */
+ if (gtperr == 0) {
+#ifdef DEBUG_QFA
+ msg("inode %ld at tapepos %ld\n", spclptr->c_inumber, curtapepos);
+#endif
+ gtperr = MkTapeString(spclptr, curtapepos);
+ }
+ /* } */
+ }
+ }
+ }
+#endif /* USE_QFA */
+
+ while (eot_count < 10 && size < bufsize) {