diff options
| author | Ed Schouten <ed@FreeBSD.org> | 2009-02-12 19:00:13 +0000 |
|---|---|---|
| committer | Ed Schouten <ed@FreeBSD.org> | 2009-02-12 19:00:13 +0000 |
| commit | 046f35128143845d5ef32ec199caff5aa14b1613 (patch) | |
| tree | bea7cb06b1ccf5fcb4c1213010f6713590a9fad7 /lib/libc | |
| parent | ae55932e231b627119dcefed6c4f7b03e35f13ce (diff) | |
Notes
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/gen/ttyslot.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/libc/gen/ttyslot.c b/lib/libc/gen/ttyslot.c index a4346267fb30..31cc15621f33 100644 --- a/lib/libc/gen/ttyslot.c +++ b/lib/libc/gen/ttyslot.c @@ -33,6 +33,7 @@ static char sccsid[] = "@(#)ttyslot.c 8.1 (Berkeley) 6/4/93"; #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include <paths.h> #include <ttyent.h> #include <stdio.h> #include <string.h> @@ -43,19 +44,17 @@ ttyslot() { struct ttyent *ttyp; int slot; - char *p; int cnt; char *name; setttyent(); for (cnt = 0; cnt < 3; ++cnt) if ( (name = ttyname(cnt)) ) { - if ( (p = rindex(name, '/')) ) - ++p; - else - p = name; + if (strncmp(name, _PATH_DEV, sizeof _PATH_DEV - 1) != 0) + break; + name += sizeof _PATH_DEV - 1; for (slot = 1; (ttyp = getttyent()); ++slot) - if (!strcmp(ttyp->ty_name, p)) { + if (!strcmp(ttyp->ty_name, name)) { endttyent(); return(slot); } |
