From: Alex Riesen Date: Thu, 09 Jul 2009 08:01:45 GMT Subject: Re: [PATCH] quickfetch(): Prevent overflow of the rev-list command line Message-ID: <81b0412b0907090101x7c8aa182o36687d67be3c5fb0@mail.gmail.com> In-Reply-To: <200907081801.36901.johan@herland.net> On Wed, Jul 8, 2009 at 18:01, Johan Herland wrote: > On Wednesday 08 July 2009, Johannes Sixt wrote: >> ... don't you get this error message with errno set to EPIPE? >> Previously, there was no error message. > > Indeed, you are correct. I guess the following should be added to the > patch: > >        if (write_in_full(revlist.in, sha1_to_hex(ref->old_sha1), 40) < 0 || >            write_in_full(revlist.in, "\n", 1) < 0) { > -               error("failed write to rev-list"); > -               err = errno; > +               if (errno != EPIPE) { > +                       error("failed write to rev-list"); > +                       err = errno; You'll loose errno this way: error() does not save it.