Commit 63e62cfb authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/img2enc: Use localtime_r() for thread saftey

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 5ece4f8b
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment