summaryrefslogtreecommitdiff
path: root/avconv_opt.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-06-12 13:39:17 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-06-12 17:02:48 +0100
commita9b2a51178ea446909015f061ab5df65e3b66bf6 (patch)
treee99dc0b5ceabe0fadb3d210451690d946825f447 /avconv_opt.c
parent8a78ae2d2101622fd244b99178d8bc61175c878e (diff)
avconv_opt: Check localtime() return value
Reported-By: infer
Diffstat (limited to 'avconv_opt.c')
-rw-r--r--avconv_opt.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/avconv_opt.c b/avconv_opt.c
index 29fc2be6dd..74307bfeb6 100644
--- a/avconv_opt.c
+++ b/avconv_opt.c
@@ -1899,6 +1899,11 @@ static int opt_vstats(void *optctx, const char *opt, const char *arg)
time_t today2 = time(NULL);
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,
today->tm_sec);
return opt_vstats_file(NULL, opt, filename);