summaryrefslogtreecommitdiff
path: root/usr.bin/split/split.c
diff options
context:
space:
mode:
authorCharles Longeau <chl@cvs.openbsd.org>2007-09-25 11:20:35 +0000
committerCharles Longeau <chl@cvs.openbsd.org>2007-09-25 11:20:35 +0000
commit379821d4ca338301b1ad7910948dbcdbd7713806 (patch)
treeb7ae2fc8cb2f93190f107d0b30281f767b326c46 /usr.bin/split/split.c
parent09944c345be5ccdda2b0574ccea1f177d2d91e49 (diff)
handle empty strings returned by fgets
ok ray@
Diffstat (limited to 'usr.bin/split/split.c')
-rw-r--r--usr.bin/split/split.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/split/split.c b/usr.bin/split/split.c
index 4f4a9653b13..eea4ae8fa47 100644
--- a/usr.bin/split/split.c
+++ b/usr.bin/split/split.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: split.c,v 1.14 2007/09/05 21:07:53 millert Exp $ */
+/* $OpenBSD: split.c,v 1.15 2007/09/25 11:20:34 chl Exp $ */
/* $NetBSD: split.c,v 1.5 1995/08/31 22:22:05 jtc Exp $ */
/*
@@ -40,7 +40,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)split.c 8.3 (Berkeley) 4/25/94";
#else
-static char rcsid[] = "$OpenBSD: split.c,v 1.14 2007/09/05 21:07:53 millert Exp $";
+static char rcsid[] = "$OpenBSD: split.c,v 1.15 2007/09/25 11:20:34 chl Exp $";
#endif
#endif /* not lint */
@@ -244,6 +244,9 @@ split2(void)
while (fgets(bfr, sizeof(bfr), infp) != NULL) {
const int len = strlen(bfr);
+ if (len == 0)
+ continue;
+
/* If line is too long to deal with, just write it out */
if (bfr[len - 1] != '\n')
goto writeit;