diff --git a/src/packet_io/dumpfile_io.cpp b/src/packet_io/dumpfile_io.cpp index a16a217..d19585c 100644 --- a/src/packet_io/dumpfile_io.cpp +++ b/src/packet_io/dumpfile_io.cpp @@ -136,15 +136,24 @@ static void *dumpfile_thread(void *arg) } else // PACKET_IO_DUMPFILELIST { - FILE *fp = fopen(handle->dumpfile_path, "r"); - if (fp == NULL) + FILE *fp = NULL; + if (strcmp(handle->dumpfile_path, "-") == 0) { - PACKET_IO_LOG_ERROR("unable to open dumpfile list: %s", handle->dumpfile_path); - goto erro_out; + PACKET_IO_LOG_ERROR("dumpfile list is empty"); + fp = stdin; + } + else + { + fp = fopen(handle->dumpfile_path, "r"); + if (fp == NULL) + { + PACKET_IO_LOG_ERROR("unable to open dumpfile list: %s", handle->dumpfile_path); + goto erro_out; + } } char line[PATH_MAX]; - while (fgets(line, sizeof(line), fp)) + while (ATOMIC_READ(&handle->io_thread_need_exit) == 0 && fgets(line, sizeof(line), fp)) { if (line[0] == '#') { @@ -159,7 +168,10 @@ static void *dumpfile_thread(void *arg) dumpfile_handler(handle, line); } - fclose(fp); + if (fp != stdin) + { + fclose(fp); + } } erro_out: