From: millert Date: Wed, 31 May 2017 19:41:30 +0000 (+0000) Subject: Use ferror() to check for getline() failure. From Scott Cheloha. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b9912a9077e917730dff01338f05c2b10a2c1278;p=openbsd Use ferror() to check for getline() failure. From Scott Cheloha. OK jung@ --- diff --git a/usr.bin/from/from.c b/usr.bin/from/from.c index 52bf5e3af03..bd2bd695801 100644 --- a/usr.bin/from/from.c +++ b/usr.bin/from/from.c @@ -1,4 +1,4 @@ -/* $OpenBSD: from.c,v 1.24 2015/11/05 18:42:41 mmcc Exp $ */ +/* $OpenBSD: from.c,v 1.25 2017/05/31 19:41:30 millert Exp $ */ /* $NetBSD: from.c,v 1.6 1995/09/01 01:39:10 jtc Exp $ */ /* @@ -98,6 +98,9 @@ main(int argc, char *argv[]) newline = 0; } free(line); + if (ferror(fp)) + err(EXIT_FAILURE, "getline"); + fclose(fp); exit(EXIT_SUCCESS); }