On Sun, May 15, 2011 at 09:32:03PM +0100, Måns Rullgård wrote:
> Diego Biurrun <[email protected]> writes:
> 
> > --- a/tools/cws2fws.c
> > +++ b/tools/cws2fws.c
> > @@ -69,7 +69,10 @@ int main(int argc, char *argv[])
> >  
> >      // write out modified header
> >      buf_in[0] = 'F';
> > -    write(fd_out, &buf_in, 8);
> > +    if (write(fd_out, &buf_in, 8) < 0) {
> > +        perror("Error writing output file");
> > +        exit(1);
> > +    }
> >  
> >      zstream.zalloc = NULL;
> >      zstream.zfree = NULL;
> > @@ -101,7 +104,10 @@ int main(int argc, char *argv[])
> >              zstream.avail_in, zstream.total_in, zstream.avail_out, 
> > zstream.total_out,
> >              zstream.total_out-last_out);
> >  
> > -        write(fd_out, &buf_out, zstream.total_out-last_out);
> > +        if (write(fd_out, &buf_out, zstream.total_out - last_out) < 0) {
> > +            perror("Error writing output file");
> > +            exit(1);
> > +        }
> >  
> >          i += len;
> >  
> > @@ -120,7 +126,10 @@ int main(int argc, char *argv[])
> >          buf_in[3] = ((zstream.total_out+8) >> 24) & 0xff;
> >  
> >          lseek(fd_out, 4, SEEK_SET);
> > -        write(fd_out, &buf_in, 4);
> > +        if (write(fd_out, &buf_in, 4) < 0) {
> 
> I obviously meant that *all* write calls should compare the return value
> against the size, not only the first one.

Doh, I only read your reply to my first patch now, sorry, will
update and resend in a bit...

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to