From b9912a9077e917730dff01338f05c2b10a2c1278 Mon Sep 17 00:00:00 2001 From: millert Date: Wed, 31 May 2017 19:41:30 +0000 Subject: [PATCH] Use ferror() to check for getline() failure. From Scott Cheloha. OK jung@ --- usr.bin/from/from.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); } -- 2.20.1