#ifdef HAVE_LIBPCAP
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <errno.h>
-#include <pcap.h>
+#include <wsutil/wspcap.h>
#include <glib.h>
char filenum[5+1];
char timestr[14+1];
time_t current_time;
+ struct tm *tm;
if (rfile->name != NULL) {
if (rb_data.unlimited == FALSE) {
current_time = time(NULL);
g_snprintf(filenum, sizeof(filenum), "%05u", (rb_data.curr_file_num + 1) % RINGBUFFER_MAX_NUM_FILES);
- strftime(timestr, sizeof(timestr), "%Y%m%d%H%M%S", localtime(¤t_time));
+ tm = localtime(¤t_time);
+ if (tm != NULL)
+ strftime(timestr, sizeof(timestr), "%Y%m%d%H%M%S", tm);
+ else
+ g_strlcpy(timestr, "196912312359", sizeof(timestr)); /* second before the Epoch */
rfile->name = g_strconcat(rb_data.fprefix, "_", filenum, "_", timestr,
rb_data.fsuffix, NULL);