summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-04-13 15:26:47 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-04-13 15:26:47 +0000
commite9b447ecf35877fed8f7336193d1c3ae5e576f83 (patch)
tree9ea38f61855fd18c9dc8aa63d8730519aef2f9fc
parented273363b5f96005fa813dc74b2498806f39604d (diff)
Use _PATH_DEV, not "/dev/"
Make init(8) call login_fbtab() correctly.
-rw-r--r--lib/libutil/login_fbtab.c5
-rw-r--r--sbin/init/init.c6
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/libutil/login_fbtab.c b/lib/libutil/login_fbtab.c
index 646199568a6..25b0e82c2a4 100644
--- a/lib/libutil/login_fbtab.c
+++ b/lib/libutil/login_fbtab.c
@@ -66,6 +66,7 @@
#include <errno.h>
#include <dirent.h>
#include <unistd.h>
+#include <paths.h>
#include "util.h"
@@ -96,7 +97,7 @@ login_fbtab(tty, uid, gid)
*cp = 0; /* strip comment */
if ((cp = devname = strtok(buf, WSPACE)) == 0)
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 != '0' ||
sscanf(cp, "%o", &prot) == 0 ||
@@ -107,7 +108,7 @@ login_fbtab(tty, uid, gid)
cp ? cp : "(null)");
continue;
}
- if (strcmp(devname + 5, tty) == 0)
+ if (strcmp(devname + sizeof(_PATH_DEV) - 1, tty) == 0)
for (cp = strtok(cp, ":"); cp; cp = strtok(NULL, ":"))
login_protect(table, cp, prot, uid, gid);
}
diff --git a/sbin/init/init.c b/sbin/init/init.c
index 2715b80b338..0b8a6cb6a70 100644
--- a/sbin/init/init.c
+++ b/sbin/init/init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init.c,v 1.12 1998/03/03 01:15:13 deraadt Exp $ */
+/* $OpenBSD: init.c,v 1.13 1998/04/13 15:26:46 millert Exp $ */
/* $NetBSD: init.c,v 1.22 1996/05/15 23:29:33 jtc Exp $ */
/*-
@@ -47,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)init.c 8.2 (Berkeley) 4/28/95";
#else
-static char rcsid[] = "$OpenBSD: init.c,v 1.12 1998/03/03 01:15:13 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: init.c,v 1.13 1998/04/13 15:26:46 millert Exp $";
#endif
#endif /* not lint */
@@ -1182,7 +1182,7 @@ collect_child(pid)
return;
clear_session_logs(sp);
- login_fbtab(sp->se_device, 0, 0);
+ login_fbtab(sp->se_device + sizeof(_PATH_DEV) - 1, 0, 0);
del_session(sp);
sp->se_process = 0;