diff options
author | Diego Biurrun <diego@biurrun.de> | 2011-05-15 18:34:11 +0200 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2011-05-16 20:56:56 +0200 |
commit | d39facc783c270227e5b7c75db3dec406ed19018 (patch) | |
tree | e334782b9f76fc00d43bd3a266a9de64e61a4ad5 /tools/cws2fws.c | |
parent | bdefbf3e8857d2861d8d57c0ef583fe15a46d1a4 (diff) | |
download | ffmpeg-d39facc783c270227e5b7c75db3dec406ed19018.tar.gz |
tools: Check the return value of write().
This fixes several warnings of the type:
warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
Diffstat (limited to 'tools/cws2fws.c')
-rw-r--r-- | tools/cws2fws.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/cws2fws.c b/tools/cws2fws.c index aa7d690be3..5fa51470df 100644 --- a/tools/cws2fws.c +++ b/tools/cws2fws.c @@ -69,7 +69,10 @@ int main(int argc, char *argv[]) // write out modified header buf_in[0] = 'F'; - write(fd_out, &buf_in, 8); + if (write(fd_out, &buf_in, 8) < 8) { + perror("Error writing output file"); + exit(1); + } zstream.zalloc = NULL; zstream.zfree = NULL; @@ -101,7 +104,10 @@ int main(int argc, char *argv[]) zstream.avail_in, zstream.total_in, zstream.avail_out, zstream.total_out, zstream.total_out-last_out); - write(fd_out, &buf_out, zstream.total_out-last_out); + if (write(fd_out, &buf_out, zstream.total_out - last_out) < zstream.total_out - last_out) { + perror("Error writing output file"); + exit(1); + } i += len; @@ -120,7 +126,10 @@ int main(int argc, char *argv[]) buf_in[3] = ((zstream.total_out+8) >> 24) & 0xff; lseek(fd_out, 4, SEEK_SET); - write(fd_out, &buf_in, 4); + if (write(fd_out, &buf_in, 4) < 4) { + perror("Error writing output file"); + exit(1); + } } inflateEnd(&zstream); |