return if fail to open file, otherwise coredump

This commit is contained in:
fang 2020-01-04 16:16:10 +08:00
parent 8eeb950083
commit 947f2a4ede
1 changed files with 5 additions and 0 deletions

View File

@ -351,6 +351,11 @@ int main(int argc, char *argv[]) {
}
FILE *fp = fopen(arguments.output_file, "a");
if (NULL == fp) {
fprintf(stderr, "Failed to open %s for writing\n", arguments.output_file);
return 1;
};
time_t tTime = time(NULL);
struct tm tm = *localtime(&tTime);