aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-02 20:09:16 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-02 20:09:16 +0100
commit63e62cfbe23de8b362d94f783668620a2cd2b571 (patch)
tree1f8c7171c40bc5517869678722be8c845ae53afb
parent5ece4f8b7362653c932e58a1c7a0456897d06702 (diff)
downloadffmpeg-63e62cfbe23de8b362d94f783668620a2cd2b571.tar.gz
avformat/img2enc: Use localtime_r() for thread saftey
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/img2enc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index b64ef07ea1..2b8b2d0606 100644
--- a/libavformat/img2enc.c
+++ b/libavformat/img2enc.c
@@ -26,6 +26,7 @@
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
+#include "libavutil/time_internal.h"
#include "avformat.h"
#include "avio_internal.h"
#include "internal.h"
@@ -83,9 +84,9 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
av_strlcpy(filename, img->path, sizeof(filename));
} else if (img->use_strftime) {
time_t now0;
- struct tm *tm;
+ struct tm *tm, tmpbuf;
time(&now0);
- tm = localtime(&now0);
+ tm = localtime_r(&now0, &tmpbuf);
if (!strftime(filename, sizeof(filename), img->path, tm)) {
av_log(s, AV_LOG_ERROR, "Could not get frame filename with strftime\n");
return AVERROR(EINVAL);