> > Index: fetch.c > > =================================================================== > > RCS file: /cvs/src/usr.bin/ftp/fetch.c,v > > retrieving revision 1.161 > > diff -u -p -r1.161 fetch.c > > --- fetch.c 28 Feb 2017 06:31:12 -0000 1.161 > > +++ fetch.c 1 Mar 2017 23:21:46 -0000 > > @@ -1041,6 +1041,8 @@ cleanup_url_get: > > fclose(fin); > > else if (s != -1) > > close(s); > > + if (out >= 0 && out != fileno(stdout)) > > + close(out); > > free(buf); > > free(proxyhost); > > free(proxyurl); > > I was wondering if the "out >= 0" condition is necessary as open(2) > errors are handled anyway.
Sure, but it is cleaner to not call close(-1).
