1 month bump. CC'd millert@ because he made the switch to getline(3) in r1.18.
Original message below. -- On Apr 20, 2017, at 8:59 PM, Scott Cheloha <[email protected]> wrote: Check whether or not getline(3) failed before exiting. It also couldn't hurt to close fp... especially given that we're freeing line, too, right before exit. Thoughts? -- Scott Cheloha Index: from.c =================================================================== RCS file: /cvs/src/usr.bin/from/from.c,v retrieving revision 1.24 diff -u -p -r1.24 from.c --- from.c 5 Nov 2015 18:42:41 -0000 1.24 +++ from.c 21 Apr 2017 01:56:48 -0000 @@ -98,6 +98,9 @@ main(int argc, char *argv[]) newline = 0; } free(line); + if (ferror(fp)) + err(1, "getline"); + fclose(fp); exit(EXIT_SUCCESS); }
