summaryrefslogtreecommitdiffstats
path: root/lib/libutil
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2002-06-25 17:42:29 +0000
committermillert <millert@openbsd.org>2002-06-25 17:42:29 +0000
commit1a4d6d3be234db811a5e8574e3b097a32e5cd637 (patch)
treefbd88388e363a98e5595e3fb3b96a035f790db78 /lib/libutil
parentIEEE1394 infrastructure part. (diff)
downloadwireguard-openbsd-1a4d6d3be234db811a5e8574e3b097a32e5cd637.tar.xz
wireguard-openbsd-1a4d6d3be234db811a5e8574e3b097a32e5cd637.zip
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 ||