summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2000-12-09 09:35:55 +0000
committerobrien <obrien@FreeBSD.org>2000-12-09 09:35:55 +0000
commitc2ee1dcc02035d781d6c70f06df7106979a9f870 (patch)
tree757810dc1fdd19be4c8125ccb9e8beb1aff3d929 /libexec
parentc174181f432119d1dae3f5e58ecc14c8d7b6f545 (diff)
downloadFreeBSD-src-c2ee1dcc02035d781d6c70f06df7106979a9f870.zip
FreeBSD-src-c2ee1dcc02035d781d6c70f06df7106979a9f870.tar.gz
Add `_PATH_DEVZERO'.
Use _PATH_* where where possible.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/bootpd/bootpd.c3
-rw-r--r--libexec/bootpd/bootpgw/bootpgw.c5
-rw-r--r--libexec/bootpd/getether.c3
-rw-r--r--libexec/rtld-aout/rtld.c5
-rw-r--r--libexec/rtld-elf/malloc.c5
-rw-r--r--libexec/telnetd/sys_term.c18
-rw-r--r--libexec/telnetd/telnetd.c5
7 files changed, 27 insertions, 17 deletions
diff --git a/libexec/bootpd/bootpd.c b/libexec/bootpd/bootpd.c
index 216e08f..aac6263 100644
--- a/libexec/bootpd/bootpd.c
+++ b/libexec/bootpd/bootpd.c
@@ -65,6 +65,7 @@ SOFTWARE.
#include <errno.h>
#include <ctype.h>
#include <netdb.h>
+#include <paths.h>
#include <syslog.h>
#include <assert.h>
@@ -395,7 +396,7 @@ main(argc, argv)
#ifdef NO_SETSID
setpgrp(0,0);
#ifdef TIOCNOTTY
- n = open("/dev/tty", O_RDWR);
+ n = open(_PATH_TTY, O_RDWR);
if (n >= 0) {
ioctl(n, TIOCNOTTY, (char *) 0);
(void) close(n);
diff --git a/libexec/bootpd/bootpgw/bootpgw.c b/libexec/bootpd/bootpgw/bootpgw.c
index b552eb3..7271a7a 100644
--- a/libexec/bootpd/bootpgw/bootpgw.c
+++ b/libexec/bootpd/bootpgw/bootpgw.c
@@ -25,6 +25,8 @@ ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
************************************************************************/
+/* $FreeBSD$ */
+
/*
* BOOTPGW is typically used to forward BOOTP client requests from
* one subnet to a BOOTP server on a different subnet.
@@ -54,6 +56,7 @@ SOFTWARE.
#include <errno.h>
#include <ctype.h>
#include <netdb.h>
+#include <paths.h>
#include <syslog.h>
#include <assert.h>
@@ -372,7 +375,7 @@ main(argc, argv)
#ifdef NO_SETSID
setpgrp(0,0);
#ifdef TIOCNOTTY
- n = open("/dev/tty", O_RDWR);
+ n = open(_PATH_TTY, O_RDWR);
if (n >= 0) {
ioctl(n, TIOCNOTTY, (char *) 0);
(void) close(n);
diff --git a/libexec/bootpd/getether.c b/libexec/bootpd/getether.c
index 8f95a59..071b5fc 100644
--- a/libexec/bootpd/getether.c
+++ b/libexec/bootpd/getether.c
@@ -18,6 +18,7 @@
#endif
#include <ctype.h>
+#include <paths.h>
#include <syslog.h>
#include "getether.h"
@@ -195,7 +196,7 @@ getether(ifname, eap)
char *enaddr;
int unit = -1; /* which unit to attach */
- snprintf(devname, sizeof(devname), "/dev/%s", ifname);
+ snprintf(devname, sizeof(devname), "%s%s", _PATH_DEV, ifname);
fd = open(devname, 2);
if (fd < 0) {
/* Try without the trailing digit. */
diff --git a/libexec/rtld-aout/rtld.c b/libexec/rtld-aout/rtld.c
index a55e9bc..3a66319 100644
--- a/libexec/rtld-aout/rtld.c
+++ b/libexec/rtld-aout/rtld.c
@@ -45,6 +45,7 @@
#include <err.h>
#include <fcntl.h>
#include <a.out.h>
+#include <paths.h>
#include <stab.h>
#include <stdio.h>
#include <stdlib.h>
@@ -66,8 +67,8 @@
#ifndef MAP_ANON
#define MAP_ANON 0
#define anon_open() do { \
- if ((anon_fd = open("/dev/zero", O_RDWR, 0)) == -1) \
- err("open: %s", "/dev/zero"); \
+ if ((anon_fd = open(_PATH_DEVZERO, O_RDWR, 0)) == -1) \
+ err("open: %s", _PATH_DEVZERO); \
} while (0)
#define anon_close() do { \
(void)close(anon_fd); \
diff --git a/libexec/rtld-elf/malloc.c b/libexec/rtld-elf/malloc.c
index 8aefa41..cb00a20 100644
--- a/libexec/rtld-elf/malloc.c
+++ b/libexec/rtld-elf/malloc.c
@@ -49,6 +49,7 @@ static char *rcsid = "$FreeBSD$";
#include <sys/types.h>
#include <err.h>
+#include <paths.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -456,9 +457,9 @@ int n;
int offset;
#ifdef NEED_DEV_ZERO
- fd = open("/dev/zero", O_RDWR, 0);
+ fd = open(_PATH_DEVZERO, O_RDWR, 0);
if (fd == -1)
- perror("/dev/zero");
+ perror(_PATH_DEVZERO);
#endif
if (pagepool_end - pagepool_start > pagesz) {
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 <sys/types.h>
#include <libutil.h>
+#include <paths.h>
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 <sys/mman.h>
#include <libutil.h>
+#include <paths.h>
#include <utmp.h>
#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");
}
OpenPOWER on IntegriCloud