[FFmpeg-devel] [PATCH] fix two checks in ffserver.c
Baptiste Coudurier
baptiste.coudurier
Wed Jun 18 23:31:16 CEST 2008
Hi,
Stefan Gehrer wrote:
> 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.
>
Here it is man 2 open.
Besides, there is some if (i) two lines after too, and I think check
should be done against -1.
> > @@ -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.
>
I'll check this.
--
Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA
Smartjog USA Inc. http://www.smartjog.com
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
More information about the ffmpeg-devel
mailing list