From: Stefan Sperling Subject: Re: gotwebd: needless double fseek() To: Omar Polo Cc: gameoftrees@openbsd.org Date: Thu, 18 May 2023 10:58:28 +0200 On Thu, May 18, 2023 at 10:54:06AM +0200, Omar Polo wrote: > Not visible in the diff, but just a couple of line later, after the > `done' label, we close both f1 and f2 with got_gotweb_closefile() that > does the fseek, ftruncate and fclose dance. > > f3 needs to be rewinded on the other hand since it's where the diff > is. > > ok? yes > diff /home/op/w/gotacl > commit - 8a078d7f1359fdf37e7bc18d6ace3c3579b98b33 > path + /home/op/w/gotacl > blob - ed987b10276ab43077d34ad182e40d494811d709 > file + gotwebd/got_operations.c > --- gotwebd/got_operations.c > +++ gotwebd/got_operations.c > @@ -1230,16 +1230,6 @@ got_open_diff_for_output(FILE **fp, struct request *c) > if (error) > goto done; > > - if (fseek(f1, 0, SEEK_SET) == -1) { > - error = got_ferror(f1, GOT_ERR_IO); > - goto done; > - } > - > - if (fseek(f2, 0, SEEK_SET) == -1) { > - error = got_ferror(f2, GOT_ERR_IO); > - goto done; > - } > - > if (fseek(f3, 0, SEEK_SET) == -1) { > error = got_ferror(f3, GOT_ERR_IO); > goto done; > >