avconv_opt: Check localtime() return value
Reported-By: infer
This commit is contained in:
parent
8a78ae2d21
commit
a9b2a51178
@ -1899,6 +1899,11 @@ static int opt_vstats(void *optctx, const char *opt, const char *arg)
|
|||||||
time_t today2 = time(NULL);
|
time_t today2 = time(NULL);
|
||||||
struct tm *today = localtime(&today2);
|
struct tm *today = localtime(&today2);
|
||||||
|
|
||||||
|
if (!today) { // maybe tomorrow
|
||||||
|
av_log(NULL, AV_LOG_FATAL, "Unable to get current time.\n");
|
||||||
|
exit_program(1);
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
|
snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
|
||||||
today->tm_sec);
|
today->tm_sec);
|
||||||
return opt_vstats_file(NULL, opt, filename);
|
return opt_vstats_file(NULL, opt, filename);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user