summaryrefslogtreecommitdiffstats
path: root/ulogd/pcap
diff options
context:
space:
mode:
authorlaforge <laforge>2003-10-16 12:56:59 +0000
committerlaforge <laforge>2003-10-16 12:56:59 +0000
commitd880bb845c93761c0ab028e6f9ec31f2c43edb1a (patch)
tree4258c28813a6a90b8b81e4ff27cb040c4c824fc0 /ulogd/pcap
parent6b3b51cb1449a0802a0700a90a26ce234a8fa622 (diff)
fix output if file exists and has a size of zero bytes (Yoshihiro Kawabe)
Diffstat (limited to 'ulogd/pcap')
-rw-r--r--ulogd/pcap/ulogd_PCAP.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/ulogd/pcap/ulogd_PCAP.c b/ulogd/pcap/ulogd_PCAP.c
index 7178b11..56c50f8 100644
--- a/ulogd/pcap/ulogd_PCAP.c
+++ b/ulogd/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",