[FFmpeg-devel] [PATCH] fix two checks in ffserver.c
Stefan Gehrer
stefan.gehrer
Wed Jun 18 22:37:24 CEST 2008
Erik Hovland wrote:
> There are a couple of erroneous checks in ffserver.c. One is to see if
> open() worked. The other is to check the validity of a string.
> diff --git a/ffserver.c b/ffserver.c
> index 5464176..6495f9a 100644
> --- a/ffserver.c
> +++ b/ffserver.c
> @@ -392,7 +392,7 @@ static void start_children(FFStream *feed)
>
> if (!ffserver_debug) {
> i = open("/dev/null", O_RDWR);
> - if (i)
> + if (i >= 0)
> dup2(i, 0);
> dup2(i, 1);
> dup2(i, 2);
This looks good to me, at least my 'man 3 open' confirms this.
> @@ -1611,7 +1611,7 @@ static void compute_stats(HTTPContext *c)
> url_fprintf(pb, "\r\n");
>
> url_fprintf(pb, "<HEAD><TITLE>%s Status</TITLE>\n", program_name);
> - if (c->stream->feed_filename)
> + if (c->stream->feed_filename[0])
> url_fprintf(pb, "<link rel=\"shortcut icon\"
href=\"%s\">\n", > c->stream->feed_filename);
> url_fprintf(pb, "</HEAD>\n<BODY>");
> url_fprintf(pb, "<H1>%s Status</H1>\n", program_name);
Even though the filename should be on heap and not on stack as you
said (allocated in line 3897), this change looks sensible.
More information about the ffmpeg-devel
mailing list