Browse Source

Use _PATH_DEV, not "/dev/"

Make init(8) call login_fbtab() correctly.
OPENBSD_2_3 OPENBSD_2_3_BASE
millert 27 years ago
parent
commit
5a3995eac2
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      src/lib/libutil/login_fbtab.c

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

@ -66,6 +66,7 @@
#include <errno.h> #include <errno.h>
#include <dirent.h> #include <dirent.h>
#include <unistd.h> #include <unistd.h>
#include <paths.h>
#include "util.h" #include "util.h"
@ -96,7 +97,7 @@ login_fbtab(tty, uid, gid)
*cp = 0; /* strip comment */ *cp = 0; /* strip comment */
if ((cp = devname = strtok(buf, WSPACE)) == 0) if ((cp = devname = strtok(buf, WSPACE)) == 0)
continue; /* empty or comment */ continue; /* empty or comment */
if (strncmp(devname, "/dev/", sizeof("/dev/")-1) != 0 ||
if (strncmp(devname, _PATH_DEV, sizeof(_PATH_DEV) - 1) != 0 ||
(cp = strtok((char *) 0, WSPACE)) == 0 || (cp = strtok((char *) 0, WSPACE)) == 0 ||
*cp != '0' || *cp != '0' ||
sscanf(cp, "%o", &prot) == 0 || sscanf(cp, "%o", &prot) == 0 ||
@ -107,7 +108,7 @@ login_fbtab(tty, uid, gid)
cp ? cp : "(null)"); cp ? cp : "(null)");
continue; continue;
} }
if (strcmp(devname + 5, tty) == 0)
if (strcmp(devname + sizeof(_PATH_DEV) - 1, tty) == 0)
for (cp = strtok(cp, ":"); cp; cp = strtok(NULL, ":")) for (cp = strtok(cp, ":"); cp; cp = strtok(NULL, ":"))
login_protect(table, cp, prot, uid, gid); login_protect(table, cp, prot, uid, gid);
} }


Loading…
Cancel
Save