[FFmpeg-cvslog] avconv_opt: Check localtime() return value
Vittorio Giovara
git at videolan.org
Fri Jun 12 22:45:38 CEST 2015
ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Fri Jun 12 13:39:17 2015 +0100| [a9b2a51178ea446909015f061ab5df65e3b66bf6] | committer: Vittorio Giovara
avconv_opt: Check localtime() return value
Reported-By: infer
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a9b2a51178ea446909015f061ab5df65e3b66bf6
---
avconv_opt.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/avconv_opt.c b/avconv_opt.c
index 29fc2be..74307bf 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);
More information about the ffmpeg-cvslog
mailing list