[FFmpeg-devel] [PATCH 2/2] cmdutils: allow specifying the report file

Michael Niedermayer michaelni at gmx.at
Fri Nov 2 00:47:52 CET 2012


On Fri, Nov 02, 2012 at 12:36:07AM +0100, Nicolas George wrote:
> Le primidi 11 brumaire, an CCXXI, Michael Niedermayer a écrit :
> > This uses a environment variable as it is tricky through the command line.
> > 
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> >  cmdutils.c |    4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/cmdutils.c b/cmdutils.c
> > index f696700..f68a25a 100644
> > --- a/cmdutils.c
> > +++ b/cmdutils.c
> > @@ -542,6 +542,10 @@ int opt_report(const char *opt)
> >               program_name,
> >               tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
> >               tm->tm_hour, tm->tm_min, tm->tm_sec);
> > +
> > +    if(getenv("FFREPORT_FILE")) {
> > +        av_strlcpy(filename, getenv("FFREPORT_FILE"), sizeof(filename));
> > +    }
> >      report_file = fopen(filename, "w");
> >      if (!report_file) {
> >          av_log(NULL, AV_LOG_ERROR, "Failed to open report \"%s\": %s\n",
> 
> From the technical point of view, it lacks a check for buffer overflow
> and/or a larger buffer (the current buffer for the filename is rather small;
> an overflow can lead to several logs being written to the same file), and a
> documentation update.
> 
> From the user perspective, I do not like the multiplication of environment
> variables.
> 
> I would like to suggest the following diff (which is not yet a patch): it
> uses the FFREPORT environment variable, just as before, but it extracts a
> filename from it if it has the form "file=something". I would like to
> implement %-expansion (at least %p for program_name = "ffmpeg", "ffplay",
> "ffprobe", etc., and %t for the date and time), but it is already working.

perfectly fine with me

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121102/62f53b5d/attachment.asc>


More information about the ffmpeg-devel mailing list