It can only be used if defined(HAVE_FORK) || defined(HAVE_VFORK).
This avoid:
tcpdump.c:3140:31: warning: unused parameter 'filename'
[-Wunused-parameter] compress_savefile(const char *filename)
(backported from commit
8fac227c17aa5f1c09f35626738cd68de03843b8)
#endif
static int Wflag; /* recycle output files after this number of files */
static int WflagChars;
#endif
static int Wflag; /* recycle output files after this number of files */
static int WflagChars;
+#if defined(HAVE_FORK) || defined(HAVE_VFORK)
static char *zflag = NULL; /* compress each savefile using a specified command (like gzip or bzip2) */
static char *zflag = NULL; /* compress each savefile using a specified command (like gzip or bzip2) */
static int timeout = 1000; /* default timeout = 1000 ms = 1 s */
#ifdef HAVE_PCAP_SET_IMMEDIATE_MODE
static int immediate_mode;
static int timeout = 1000; /* default timeout = 1000 ms = 1 s */
#ifdef HAVE_PCAP_SET_IMMEDIATE_MODE
static int immediate_mode;
+#if defined(HAVE_FORK) || defined(HAVE_VFORK)
+#else
+ warning("-z ignored. Fork subprocess not implemented.\n");
+#endif
_exit(S_ERR_HOST_PROGRAM);
#endif
}
_exit(S_ERR_HOST_PROGRAM);
#endif
}
-#else /* HAVE_FORK && HAVE_VFORK */
-static void
-compress_savefile(const char *filename)
-{
- fprintf(stderr,
- "%s failed. Functionality not implemented under your system\n",
- __func__);
-}
-#endif /* HAVE_FORK && HAVE_VFORK */
+#endif /* HAVE_FORK || HAVE_VFORK */
static void
dump_packet_and_trunc(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
static void
dump_packet_and_trunc(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
*/
pcap_dump_close(dump_info->pdd);
*/
pcap_dump_close(dump_info->pdd);
+#if defined(HAVE_FORK) || defined(HAVE_VFORK)
/*
* Compress the file we just closed, if the user asked for it
*/
if (zflag != NULL)
compress_savefile(dump_info->CurrentFileName);
/*
* Compress the file we just closed, if the user asked for it
*/
if (zflag != NULL)
compress_savefile(dump_info->CurrentFileName);
/*
* Check to see if we've exceeded the Wflag (when
/*
* Check to see if we've exceeded the Wflag (when
*/
pcap_dump_close(dump_info->pdd);
*/
pcap_dump_close(dump_info->pdd);
+#if defined(HAVE_FORK) || defined(HAVE_VFORK)
/*
* Compress the file we just closed, if the user
* asked for it.
*/
if (zflag != NULL)
compress_savefile(dump_info->CurrentFileName);
/*
* Compress the file we just closed, if the user
* asked for it.
*/
if (zflag != NULL)
compress_savefile(dump_info->CurrentFileName);
Cflag_count++;
if (Wflag > 0) {
Cflag_count++;
if (Wflag > 0) {