Browse Source

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.
OPENBSD_3_2
millert 22 years ago
parent
commit
b013f0d14d
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      src/lib/libutil/login_fbtab.c

+ 4
- 3
src/lib/libutil/login_fbtab.c View File

@ -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 * 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; buf = tbuf;
} }
if ((cp = strchr(buf, '#'))) 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 */ continue; /* empty or comment */
if (strncmp(devname, _PATH_DEV, sizeof(_PATH_DEV) - 1) != 0 || if (strncmp(devname, _PATH_DEV, sizeof(_PATH_DEV) - 1) != 0 ||
(cp = strtok_r(NULL, WSPACE, &toklast)) == NULL || (cp = strtok_r(NULL, WSPACE, &toklast)) == NULL ||


Loading…
Cancel
Save