Using new variable log_filename for fopen call
parent
d7ca908493
commit
a9c9a73df7
11
candump.c
11
candump.c
|
|
@ -672,14 +672,7 @@ int main(int argc, char **argv)
|
||||||
now.tm_hour,
|
now.tm_hour,
|
||||||
now.tm_min,
|
now.tm_min,
|
||||||
now.tm_sec);
|
now.tm_sec);
|
||||||
} else {
|
log_filename = fname;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (silent != SILENT_ON)
|
if (silent != SILENT_ON)
|
||||||
|
|
@ -687,7 +680,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
fprintf(stderr, "Enabling Logfile '%s'\n", fname);
|
fprintf(stderr, "Enabling Logfile '%s'\n", fname);
|
||||||
|
|
||||||
logfile = fopen(fname, "w");
|
logfile = fopen(log_filename, "w");
|
||||||
if (!logfile) {
|
if (!logfile) {
|
||||||
perror("logfile");
|
perror("logfile");
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue