+#endif /* HAVE_BZLIB */
+ if (compresult && worklen <= (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 */
+
+ if (sigsetjmp(jmpbuf, 1) == 0) {
+ ready = 1;
+ if (!caught)
+ sigsuspend(&set);
+ }
+ ready = 0;
+ caught = 0;
+
+#ifdef USE_QFA
+ if (gTapeposfd >= 0) {
+ int i;
+ int firstpass = 1;
+ for (i = 0; i < ntrec; ++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_dinode.di_mode & S_IFMT) != IFDIR) &&
+ (spclptr->c_date == gThisDumpDate)) {
+ /* if an error occured previously don't
+ * try again */
+ if (firstpass) {
+ firstpass = 0;
+ if (gtperr == 0)
+ gtperr = GetTapePos(&curtapepos);
+ }
+ if (gtperr == 0)
+ MkTapeString(spclptr, curtapepos);
+ }
+ }
+ }
+#endif /* USE_QFA */
+
+ while (eot_count < 10 && size < bufsize) {