diff options
author | Jeremy Allison <jeremy@jeremy-desktop.(none)> | 2008-12-22 20:08:14 -0800 |
---|---|---|
committer | Jeremy Allison <jeremy@jeremy-desktop.(none)> | 2008-12-22 20:08:14 -0800 |
commit | aaea68791cfea45c6fa69abc93ad6d0e832d0283 (patch) | |
tree | e583e6f7950266b51e53404f5246464b05773487 /lib/socket_wrapper | |
parent | a7f64ba2f1d49b65cd96ba862f6b80b28c3e6dd2 (diff) | |
download | samba-aaea68791cfea45c6fa69abc93ad6d0e832d0283.tar.gz samba-aaea68791cfea45c6fa69abc93ad6d0e832d0283.tar.bz2 samba-aaea68791cfea45c6fa69abc93ad6d0e832d0283.zip |
In gcc version 4.3.2 we get warnings for functions declared with
attribute warn_unused_result. Start to fix these.
Jeremy.
Diffstat (limited to 'lib/socket_wrapper')
-rw-r--r-- | lib/socket_wrapper/socket_wrapper.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/socket_wrapper/socket_wrapper.c b/lib/socket_wrapper/socket_wrapper.c index 9d61976950..dc0124bdb7 100644 --- a/lib/socket_wrapper/socket_wrapper.c +++ b/lib/socket_wrapper/socket_wrapper.c @@ -899,7 +899,10 @@ static int swrap_get_pcap_fd(const char *fname) file_hdr.frame_max_len = SWRAP_FRAME_LENGTH_MAX; file_hdr.link_type = 0x0065; /* 101 RAW IP */ - write(fd, &file_hdr, sizeof(file_hdr)); + if (write(fd, &file_hdr, sizeof(file_hdr)) != sizeof(file_hdr)) { + close(fd); + return -1; + } return fd; } @@ -1190,7 +1193,12 @@ static void swrap_dump_packet(struct socket_info *si, fd = swrap_get_pcap_fd(file_name); if (fd != -1) { - write(fd, packet, packet_len); + if (write(fd, packet, packet_len) != packet_len) { + close(fd); + free(packet); + return; + } + close(fd); } free(packet); |