Using new variable log_filename for fopen call

pull/345/head
xR3b0rn 2022-02-15 17:45:21 +01:00 committed by GitHub
parent d7ca908493
commit a9c9a73df7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 9 deletions

View File

@ -672,14 +672,7 @@ int main(int argc, char **argv)
now.tm_hour,
now.tm_min,
now.tm_sec);
} else {
int len = strlen(log_filename);
if (len > sizeof(fname) - 1) {
fprintf(stderr, "fname of -l argument must not exceed %lu characters\n", sizeof(fname) - 1);
return 1;
}
memcpy(fname, log_filename, len);
fname[len] = 0;
log_filename = fname;
}
if (silent != SILENT_ON)
@ -687,7 +680,7 @@ int main(int argc, char **argv)
fprintf(stderr, "Enabling Logfile '%s'\n", fname);
logfile = fopen(fname, "w");
logfile = fopen(log_filename, "w");
if (!logfile) {
perror("logfile");
return 1;