--- yencode-0.4.6.orig/src/yencode.c.bak 2002-03-18 19:20:06.000000000 +0200 +++ yencode-0.4.6.orig/src/yencode.c 2008-10-07 23:43:32.016803846 +0300 @@ -412,7 +412,8 @@ yencode_file(YENCFILE *f, FILE *in, size } /* Close this file */ - fclose(out); + if (fflush(out)) f->ok = 0; + if (fclose(out)) f->ok = 0; output_summary(f->input_filename, outfile, part, totalparts, decpart, encpart + headers); @@ -424,6 +425,7 @@ yencode_file(YENCFILE *f, FILE *in, size if (opt_multipart_size) { CRC_FINISH(crc32); + int writeok = 1; for (p = 1; p <= part; p++) { @@ -434,10 +436,11 @@ yencode_file(YENCFILE *f, FILE *in, size fprintf(out, " crc32=%08X\r\n", crc32); else fprintf(out, "\r\n"); - fclose(out); + if (fflush(out)) writeok = 0; + if (fclose(out)) writeok = 0; } - f->ok = 1; + f->ok = writeok; f->crc = crc32; } return (f->ok); --- yencode-0.4.6.orig/src/ydecode.c.bak 2002-03-16 07:29:14.000000000 +0200 +++ yencode-0.4.6.orig/src/ydecode.c 2008-10-07 23:52:40.631804821 +0300 @@ -520,8 +520,10 @@ ydecode_data(YDECFILE *y, FILE *in, FILE ErrERR("%s", y->output_filename); if (ferror(in)) ErrERR("%s", y->input_filename); - if (out && ferror(out)) - ErrERR("%s", y->output_filename); + if (out) { + if (fflush(out) || ferror(out)) + ErrERR("%s", y->output_filename); + } return (0); } @@ -562,8 +564,9 @@ ydecode_single(YDECFILE *y) /* Clean up */ fclose(in); - if (out) - fclose(out); + if (out) { + if (fclose(out)) errors++; + } /* Check for errors */ if (y->header->size && (*y->header->size != decodedsize))