summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-01-20 00:37:57 +0100
committerStefan Metzmacher <metze@samba.org>2009-01-20 00:42:01 +0100
commitbd576b93bd8a136e1da8cbac154aa87ab1873c1c (patch)
tree99e9fe666670318739278ec5a522a8d6ca80af7e
parent930b3c15da0bb24672d95ed388957b542cb24f89 (diff)
downloadsamba-bd576b93bd8a136e1da8cbac154aa87ab1873c1c.tar.gz
samba-bd576b93bd8a136e1da8cbac154aa87ab1873c1c.tar.bz2
samba-bd576b93bd8a136e1da8cbac154aa87ab1873c1c.zip
socket_wrapper: fix PCAP support broken by aaea68791cfea45c6fa69abc93ad6d0e832d0283
We should note close the fd after writing the first packet. metze
-rw-r--r--lib/socket_wrapper/socket_wrapper.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/socket_wrapper/socket_wrapper.c b/lib/socket_wrapper/socket_wrapper.c
index dc0124bdb7..1e3927705b 100644
--- a/lib/socket_wrapper/socket_wrapper.c
+++ b/lib/socket_wrapper/socket_wrapper.c
@@ -901,7 +901,7 @@ static int swrap_get_pcap_fd(const char *fname)
if (write(fd, &file_hdr, sizeof(file_hdr)) != sizeof(file_hdr)) {
close(fd);
- return -1;
+ fd = -1;
}
return fd;
}
@@ -1194,11 +1194,9 @@ static void swrap_dump_packet(struct socket_info *si,
fd = swrap_get_pcap_fd(file_name);
if (fd != -1) {
if (write(fd, packet, packet_len) != packet_len) {
- close(fd);
free(packet);
return;
}
- close(fd);
}
free(packet);