From: Victor Julien Date: Thu, 28 Jun 2012 17:37:02 +0000 (+0200) Subject: Don't display a warning when log-pcap tries to remove an already removed file. X-Git-Tag: suricata-1.3rc1~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8cd460dde538566136a6616ab000a7aeee8237eb;p=thirdparty%2Fsuricata.git Don't display a warning when log-pcap tries to remove an already removed file. --- diff --git a/src/log-pcap.c b/src/log-pcap.c index 4db305addd..d1a6cba935 100644 --- a/src/log-pcap.c +++ b/src/log-pcap.c @@ -188,31 +188,29 @@ int PcapLogRotateFile(ThreadVars *t, PcapLogData *pl) SCLogDebug("Removing pcap file %s", pf->filename); if (remove(pf->filename) != 0) { - SCLogWarning(SC_ERR_PCAP_FILE_DELETE_FAILED, - "failed to remove log file %s: %s", - pf->filename, strerror( errno )); + // VJ remove can fail because file is already gone + //LogWarning(SC_ERR_PCAP_FILE_DELETE_FAILED, + // "failed to remove log file %s: %s", + // pf->filename, strerror( errno )); } - else { - SCLogDebug("success! removed log file %s", pf->filename); - /* Remove directory if Sguil mode and no files left in sguil dir */ - if (pl->mode == LOGMODE_SGUIL) { - pfnext = TAILQ_NEXT(pf,next); - - if (strcmp(pf->dirname, pfnext->dirname) == 0) { - SCLogDebug("Current entry dir %s and next entry %s " - "are equal: not removing dir", - pf->dirname, pfnext->dirname); - } else { - SCLogDebug("current entry %s and %s are " - "not equal: removing dir", - pf->dirname, pfnext->dirname); - - if (remove(pf->dirname) != 0) { - SCLogWarning(SC_ERR_PCAP_FILE_DELETE_FAILED, - "failed to remove sguil log %s: %s", - pf->dirname, strerror( errno )); - } + /* Remove directory if Sguil mode and no files left in sguil dir */ + if (pl->mode == LOGMODE_SGUIL) { + pfnext = TAILQ_NEXT(pf,next); + + if (strcmp(pf->dirname, pfnext->dirname) == 0) { + SCLogDebug("Current entry dir %s and next entry %s " + "are equal: not removing dir", + pf->dirname, pfnext->dirname); + } else { + SCLogDebug("current entry %s and %s are " + "not equal: removing dir", + pf->dirname, pfnext->dirname); + + if (remove(pf->dirname) != 0) { + SCLogWarning(SC_ERR_PCAP_FILE_DELETE_FAILED, + "failed to remove sguil log %s: %s", + pf->dirname, strerror( errno )); } } }