summaryrefslogtreecommitdiff
path: root/lib/libutil
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-06-25 17:42:30 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-06-25 17:42:30 +0000
commit13f7b30bebfeac8de71e91e20ea5429e80da1e4b (patch)
tree5e91c4721dc2d8718d7565226d05288ab45a8de7 /lib/libutil
parent528fcb599b2cea28edf5c93d67df64aa72adaa6c (diff)
Now that we don't have a trailing newline we need to explicitly check
that the first char in the line is not NUL after killing comments.
Diffstat (limited to 'lib/libutil')
-rw-r--r--lib/libutil/login_fbtab.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libutil/login_fbtab.c b/lib/libutil/login_fbtab.c
index 40703267a7c..6bc5a854a75 100644
--- a/lib/libutil/login_fbtab.c
+++ b/lib/libutil/login_fbtab.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: login_fbtab.c,v 1.10 2002/06/22 00:18:58 millert Exp $ */
+/* $OpenBSD: login_fbtab.c,v 1.11 2002/06/25 17:42:29 millert Exp $ */
/************************************************************************
* Copyright 1995 by Wietse Venema. All rights reserved. Some individual
@@ -103,8 +103,9 @@ login_fbtab(const char *tty, uid_t uid, gid_t gid)
buf = tbuf;
}
if ((cp = strchr(buf, '#')))
- *cp = 0; /* strip comment */
- if ((cp = devname = strtok_r(buf, WSPACE, &toklast)) == NULL)
+ *cp = '\0'; /* strip comment */
+ if (buf[0] == '\0' ||
+ (cp = devname = strtok_r(buf, WSPACE, &toklast)) == NULL)
continue; /* empty or comment */
if (strncmp(devname, _PATH_DEV, sizeof(_PATH_DEV) - 1) != 0 ||
(cp = strtok_r(NULL, WSPACE, &toklast)) == NULL ||