]> git.ipfire.org Git - thirdparty/ulogd2.git/commitdiff
fix output if file exists and has a size of zero bytes (Yoshihiro Kawabe)
authorlaforge <laforge>
Thu, 16 Oct 2003 12:56:59 +0000 (12:56 +0000)
committerlaforge <laforge>
Thu, 16 Oct 2003 12:56:59 +0000 (12:56 +0000)
pcap/ulogd_PCAP.c

index 7178b1118ac3e7546d8ab8e3c7822c260740ff19..56c50f8306c9394e59500d4e48406de1a4d7722e 100644 (file)
@@ -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",