[FFmpeg-cvslog] r13708 - trunk/ffmpeg.c

Måns Rullgård mans
Sun Jun 8 19:22:46 CEST 2008


michael <subversion at mplayerhq.hu> writes:

> Author: michael
> Date: Sun Jun  8 12:48:23 2008
> New Revision: 13708
>
> Log:
> Search /usr(/local)/share for preset files as well.
> This also fixed a null pointer dereference if HOME isnt set.
>
> Modified:
>    trunk/ffmpeg.c
>
> Modified: trunk/ffmpeg.c
> ==============================================================================
> --- trunk/ffmpeg.c	(original)
> +++ trunk/ffmpeg.c	Sun Jun  8 12:48:23 2008
> @@ -3638,19 +3638,25 @@ static int opt_bsf(const char *opt, cons
>
>  static int opt_preset(const char *opt, const char *arg)
>  {
> -    FILE *f;
> +    FILE *f=NULL;
>      char tmp[100], tmp2[100];
> -    char *home= getenv("HOME");
> +    int i;
> +    const char *base[3]= { getenv("HOME"),
> +                           "/usr/local/share",
> +                           "/usr/share",
> +                         };
>
> -    snprintf(tmp, sizeof(tmp), "%s/.ffmpeg/%s.ffpreset", home, arg);
> +    for(i=!base[0]; i<3 && !f; i++){

Nice one.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-cvslog mailing list