2
0
mirror of https://github.com/vasi/pixz synced 2024-11-18 15:26:46 +00:00

Check return values of fwrite()

This commit is contained in:
Dave Vasilevsky 2013-06-11 01:51:19 -04:00
parent 7cb4483962
commit 4a5fffc19c

9
read.c
View File

@ -181,8 +181,10 @@ void pixz_read(bool verify, size_t nspecs, char **specs) {
if (ib->btype == BLOCK_UNSIZED) if (ib->btype == BLOCK_UNSIZED)
all_sized = false; all_sized = false;
if (!skipping) if (!skipping) {
fwrite(ib->output, ib->outsize, 1, gOutFile); if (fwrite(ib->output, ib->outsize, 1, gOutFile) != 1)
die("Can't write block");
}
queue_push(gPipelineStartQ, PIPELINE_ITEM, pi); queue_push(gPipelineStartQ, PIPELINE_ITEM, pi);
} }
} }
@ -618,7 +620,8 @@ static bool tar_next_block(void) {
static void tar_write_last(void) { static void tar_write_last(void) {
if (gArItem) { if (gArItem) {
io_block_t *ib = (io_block_t*)(gArItem->data); io_block_t *ib = (io_block_t*)(gArItem->data);
fwrite(ib->output + gArLastOffset, gArLastSize, 1, gOutFile); if (fwrite(ib->output + gArLastOffset, gArLastSize, 1, gOutFile) != 1)
die("Can't write previous block");
gArLastSize = 0; gArLastSize = 0;
} }
} }