diff options
author | laforge <laforge> | 2003-10-16 12:56:59 +0000 |
---|---|---|
committer | laforge <laforge> | 2003-10-16 12:56:59 +0000 |
commit | b7d702b97eb0000c9612fb16c670fe9d0fb82cd0 (patch) | |
tree | fc3f2e5cfa83d21313e9e5412a127be4ea8ecf23 | |
parent | c2dc230b237a9eef9ed3c64708a2f719fc9a1db6 (diff) |
fix output if file exists and has a size of zero bytes (Yoshihiro Kawabe)
-rw-r--r-- | pcap/ulogd_PCAP.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/pcap/ulogd_PCAP.c b/pcap/ulogd_PCAP.c index 7178b11..56c50f8 100644 --- a/pcap/ulogd_PCAP.c +++ b/pcap/ulogd_PCAP.c @@ -1,4 +1,4 @@ -/* ulogd_PCAP.c, Version $Revision: 1.5 $ +/* ulogd_PCAP.c, Version $Revision: 1.6 $ * * ulogd output target for writing pcap-style files (like tcpdump) * @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: ulogd_PCAP.c,v 1.5 2003/08/23 17:25:59 laforge Exp $ + * $Id: ulogd_PCAP.c,v 1.6 2003/09/28 15:19:27 laforge Exp $ * */ @@ -154,8 +154,13 @@ static int get_ids(void) void append_create_outfile(void) { struct stat st_dummy; + int exist = 0; - if (stat(pcapf_ce.u.string, &st_dummy)) { + if (stat(pcapf_ce.u.string, &st_dummy) == 0 && st.st_size > 0) { + exist = 1; + } + + if (!exist) { of = fopen(pcapf_ce.u.string, "w"); if (!of) { ulogd_log(ULOGD_FATAL, "can't open pcap file: %s\n", |