X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=cmdutils.c;h=7e587de0ec8fc7966b53137fe5dfbbef734acf87;hb=70c0f13a9a40323456d8810a7a1ee0a6256c3384;hp=1c392d7c7153686c84291a5a9394dfa723f5cf7f;hpb=b0c543b1deba77647911be159b013760b5d05db3;p=ffmpeg diff --git a/cmdutils.c b/cmdutils.c index 1c392d7c715..7e587de0ec8 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -562,7 +562,7 @@ static void expand_filename_template(AVBPrint *bp, const char *template, static int init_report(const char *env) { - const char *filename_template = "%p-%t.log"; + char *filename_template = NULL; char *key, *val; int ret, count = 0; time_t now; @@ -582,8 +582,11 @@ static int init_report(const char *env) av_err2str(ret)); break; } + if (*env) + env++; count++; if (!strcmp(key, "file")) { + av_free(filename_template); filename_template = val; val = NULL; } else { @@ -594,7 +597,9 @@ static int init_report(const char *env) } av_bprint_init(&filename, 0, 1); - expand_filename_template(&filename, filename_template, tm); + expand_filename_template(&filename, + av_x_if_null(filename_template, "%p-%t.log"), tm); + av_free(filename_template); if (!av_bprint_is_complete(&filename)) { av_log(NULL, AV_LOG_ERROR, "Out of memory building report file name\n"); return AVERROR(ENOMEM);