This fixes several warnings of the type:
warning: ignoring return value of ‘write’, declared with attribute
warn_unused_result
---
tools/cws2fws.c | 9 ++++++---
tools/pktdumper.c | 3 ++-
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/tools/cws2fws.c b/tools/cws2fws.c
index aa7d690..b73ddd7 100644
--- a/tools/cws2fws.c
+++ b/tools/cws2fws.c
@@ -69,7 +69,8 @@ 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) < 0)
+ exit(1);
zstream.zalloc = NULL;
zstream.zfree = NULL;
@@ -101,7 +102,8 @@ 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) < 0)
+ exit(1);
i += len;
@@ -120,7 +122,8 @@ 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) < 0)
+ exit(1);
}
inflateEnd(&zstream);
diff --git a/tools/pktdumper.c b/tools/pktdumper.c
index 3ab39ee..7bee402 100644
--- a/tools/pktdumper.c
+++ b/tools/pktdumper.c
@@ -104,7 +104,8 @@ int main(int argc, char **argv)
//printf("open(\"%s\")\n", pktfilename);
if (!nowrite) {
fd = open(pktfilename, O_WRONLY|O_CREAT, 0644);
- write(fd, pkt.data, pkt.size);
+ if (write(fd, pkt.data, pkt.size) > 0)
+ return 1;
close(fd);
}
av_free_packet(&pkt);
--
1.7.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel