correctly handle filter file loading error, small tweak

This commit is contained in:
cathugger
2020-05-22 17:55:37 +00:00
parent 897dcbd350
commit e933a9b806
3 changed files with 13 additions and 3 deletions

10
main.c
View File

@@ -3,6 +3,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
#include <pthread.h>
@@ -256,8 +257,13 @@ int main(int argc,char **argv)
exit(0);
}
else if (*arg == 'f') {
if (argc--)
loadfilterfile(*argv++);
if (argc--) {
const char *filename = *argv++;
if (!loadfilterfile(filename)) {
fprintf(stderr,"failed to load filter file %s\n",filename);
exit(1);
}
}
else
e_additional();
}