From c2ee1dcc02035d781d6c70f06df7106979a9f870 Mon Sep 17 00:00:00 2001 From: obrien Date: Sat, 9 Dec 2000 09:35:55 +0000 Subject: Add `_PATH_DEVZERO'. Use _PATH_* where where possible. --- libexec/telnetd/sys_term.c | 18 ++++++++++-------- libexec/telnetd/telnetd.c | 5 +++-- 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'libexec/telnetd') diff --git a/libexec/telnetd/sys_term.c b/libexec/telnetd/sys_term.c index 306449a..b1ca5c4 100644 --- a/libexec/telnetd/sys_term.c +++ b/libexec/telnetd/sys_term.c @@ -190,6 +190,7 @@ int ttyfd = -1; #include #include +#include int cleanopen __P((char *)); void scrub_env __P((void)); @@ -512,7 +513,8 @@ int *ptynum; #endif #ifndef __hpux - (void) strcpy(line, "/dev/ptyXX"); + (void) strcpy(line, _PATH_DEV); + (void) strcat(line, "ptyXX"); p1 = &line[8]; p2 = &line[9]; #else @@ -563,7 +565,7 @@ int *ptynum; struct stat sb; for (*ptynum = lowpty; *ptynum <= highpty; (*ptynum)++) { - (void) sprintf(myline, "/dev/pty/%03d", *ptynum); + (void) sprintf(myline, "%spty/%03d", _PATH_DEV, *ptynum); p = open(myline, 2); if (p < 0) continue; @@ -1325,7 +1327,7 @@ login_tty(t) * the indirect /dev/tty interface. */ close(t); - if ((t = open("/dev/tty", O_RDWR)) < 0) + if ((t = open(_PATH_TTY, O_RDWR)) < 0) fatalperror(net, "open(/dev/tty)"); # endif # else @@ -1414,7 +1416,7 @@ startslave(host, autologin, autoname) wtmp.ut_pid = pid; SCPYN(wtmp.ut_user, "LOGIN"); SCPYN(wtmp.ut_host, host); - SCPYN(wtmp.ut_line, line + sizeof("/dev/") - 1); + SCPYN(wtmp.ut_line, line + sizeof(_PATH_DEV) - 1); #ifndef __hpux SCPYN(wtmp.ut_id, wtmp.ut_line+3); #else @@ -1546,7 +1548,7 @@ start_login(host, autologin, name) bzero(&utmpx, sizeof(utmpx)); SCPYN(utmpx.ut_user, ".telnet"); - SCPYN(utmpx.ut_line, line + sizeof("/dev/") - 1); + SCPYN(utmpx.ut_line, line + sizeof(_PATH_DEV) - 1); utmpx.ut_pid = pid; utmpx.ut_id[0] = 't'; utmpx.ut_id[1] = 'n'; @@ -1823,7 +1825,7 @@ cleanup(sig) # if (BSD > 43) || defined(convex) char *p; - p = line + sizeof("/dev/") - 1; + p = line + sizeof(_PATH_DEV) - 1; if (logout(p)) logwtmp(p, "", ""); (void)chmod(line, 0666); @@ -2102,7 +2104,7 @@ rmut() * This updates the utmpx and utmp entries and make a wtmp/x entry */ - SCPYN(utmpx.ut_line, line + sizeof("/dev/") - 1); + SCPYN(utmpx.ut_line, line + sizeof(_PATH_DEV) - 1); utxp = getutxline(&utmpx); if (utxp) { utxp->ut_type = DEAD_PROCESS; @@ -2163,7 +2165,7 @@ rmut() } (void) chmod(line, 0666); (void) chown(line, 0, 0); - line[strlen("/dev/")] = 'p'; + line[strlen(_PATH_DEV)] = 'p'; (void) chmod(line, 0666); (void) chown(line, 0, 0); } /* end of rmut */ diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c index ac0260e..5695f51 100644 --- a/libexec/telnetd/telnetd.c +++ b/libexec/telnetd/telnetd.c @@ -62,6 +62,7 @@ static const char rcsid[] = #include #include +#include #include #if defined(_SC_CRAY_SECURE_SYS) @@ -824,10 +825,10 @@ doit(who) if (secflag) { char slave_dev[16]; - sprintf(tty_dev, "/dev/pty/%03d", ptynum); + sprintf(tty_dev, "%spty/%03d", _PATH_DEV, ptynum); if (setdevs(tty_dev, &dv) < 0) fatal(net, "cannot set pty security"); - sprintf(slave_dev, "/dev/ttyp%03d", ptynum); + sprintf(slave_dev, "%sp%03d", _PATH_TTY, ptynum); if (setdevs(slave_dev, &dv) < 0) fatal(net, "cannot set tty security"); } -- cgit v1.1