diff options
author | 2014-09-10 13:16:20 +0000 | |
---|---|---|
committer | 2014-09-10 13:16:20 +0000 | |
commit | 54def46922eb64ce35aeb2f685457f7ac0390150 (patch) | |
tree | 27b4f9089b7563fbe168ade0659df0d96e27288e | |
parent | document \<word\> as being non standard (diff) | |
download | wireguard-openbsd-54def46922eb64ce35aeb2f685457f7ac0390150.tar.xz wireguard-openbsd-54def46922eb64ce35aeb2f685457f7ac0390150.zip |
Remove redundant null check and rename vars consistently in syslogd
Merge in more functionality from bluhm's patch.
ok bluhm@
-rw-r--r-- | usr.sbin/syslogd/privsep.c | 10 | ||||
-rw-r--r-- | usr.sbin/syslogd/syslogd.c | 20 | ||||
-rw-r--r-- | usr.sbin/syslogd/syslogd.h | 10 |
3 files changed, 20 insertions, 20 deletions
diff --git a/usr.sbin/syslogd/privsep.c b/usr.sbin/syslogd/privsep.c index 499d49979ee..4283d66b103 100644 --- a/usr.sbin/syslogd/privsep.c +++ b/usr.sbin/syslogd/privsep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: privsep.c,v 1.44 2014/09/08 00:43:42 doug Exp $ */ +/* $OpenBSD: privsep.c,v 1.45 2014/09/10 13:16:20 doug Exp $ */ /* * Copyright (c) 2003 Anil Madhavapeddy <anil@recoil.org> @@ -172,7 +172,7 @@ priv_init(char *conf, int numeric, int lockfd, int nullfd, char *argv[]) close(socks[1]); /* Close descriptors that only the unpriv child needs */ - for (i = 0; i < nfunix; i++) + for (i = 0; i < nunix; i++) if (pfd[PFD_UNIX_0 + i].fd != -1) close(pfd[PFD_UNIX_0 + i].fd); if (pfd[PFD_INET].fd != -1) @@ -371,9 +371,9 @@ priv_init(char *conf, int numeric, int lockfd, int nullfd, char *argv[]) close(socks[0]); /* Unlink any domain sockets that have been opened */ - for (i = 0; i < nfunix; i++) - if (funixn[i] != NULL && pfd[PFD_UNIX_0 + i].fd != -1) - (void)unlink(funixn[i]); + for (i = 0; i < nunix; i++) + if (pfd[PFD_UNIX_0 + i].fd != -1) + (void)unlink(path_unix[i]); if (ctlsock_path != NULL && pfd[PFD_CTLSOCK].fd != -1) (void)unlink(ctlsock_path); diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 82684790348..b8d5768fbb0 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syslogd.c,v 1.123 2014/09/08 00:43:42 doug Exp $ */ +/* $OpenBSD: syslogd.c,v 1.124 2014/09/10 13:16:20 doug Exp $ */ /* * Copyright (c) 1983, 1988, 1993, 1994 @@ -183,8 +183,8 @@ char *TypeNames[9] = { struct filed *Files; struct filed consfile; -int nfunix = 1; /* Number of Unix domain sockets requested */ -char *funixn[MAXFUNIX] = { _PATH_LOG }; /* Paths to Unix domain sockets */ +int nunix = 1; /* Number of Unix domain sockets requested */ +char *path_unix[MAXUNIX] = { _PATH_LOG }; /* Paths to Unix domain sockets */ int Debug; /* debug flag */ int Startup = 1; /* startup flag */ char LocalHostName[MAXHOSTNAMELEN]; /* our hostname */ @@ -321,18 +321,18 @@ main(int argc, char *argv[]) NoDNS = 1; break; case 'p': /* path */ - funixn[0] = optarg; + path_unix[0] = optarg; break; case 'u': /* allow udp input port */ SecureMode = 0; break; case 'a': - if (nfunix >= MAXFUNIX) + if (nunix >= MAXUNIX) fprintf(stderr, "syslogd: " "out of descriptors, ignoring %s\n", optarg); else - funixn[nfunix++] = optarg; + path_unix[nunix++] = optarg; break; case 's': ctlsock_path = optarg; @@ -442,8 +442,8 @@ main(int argc, char *argv[]) #ifndef SUN_LEN #define SUN_LEN(unp) (strlen((unp)->sun_path) + 2) #endif - for (i = 0; i < nfunix; i++) { - if ((fd = unix_socket(funixn[i], SOCK_DGRAM, 0666)) == -1) { + for (i = 0; i < nunix; i++) { + if ((fd = unix_socket(path_unix[i], SOCK_DGRAM, 0666)) == -1) { if (i == 0 && !Debug) die(0); continue; @@ -577,7 +577,7 @@ main(int argc, char *argv[]) dprintf("syslogd: restarted\n"); } - switch (poll(pfd, PFD_UNIX_0 + nfunix, -1)) { + switch (poll(pfd, PFD_UNIX_0 + nunix, -1)) { case 0: continue; case -1: @@ -602,7 +602,7 @@ main(int argc, char *argv[]) if ((pfd[PFD_CTLCONN].revents & POLLOUT) != 0) ctlconn_write_handler(); - for (i = 0; i < nfunix; i++) { + for (i = 0; i < nunix; i++) { if ((pfd[PFD_UNIX_0 + i].revents & POLLIN) != 0) { unix_read_handler(pfd[PFD_UNIX_0 + i].fd); } diff --git a/usr.sbin/syslogd/syslogd.h b/usr.sbin/syslogd/syslogd.h index 63a2e03c678..42599daa1d8 100644 --- a/usr.sbin/syslogd/syslogd.h +++ b/usr.sbin/syslogd/syslogd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: syslogd.h,v 1.13 2014/09/08 00:43:42 doug Exp $ */ +/* $OpenBSD: syslogd.h,v 1.14 2014/09/10 13:16:20 doug Exp $ */ /* * Copyright (c) 2003 Anil Madhavapeddy <anil@recoil.org> @@ -39,9 +39,9 @@ void send_fd(int, int); int receive_fd(int); /* The list of domain sockets */ -#define MAXFUNIX 21 -extern int nfunix; -extern char *funixn[MAXFUNIX]; +#define MAXUNIX 21 +extern int nunix; +extern char *path_unix[MAXUNIX]; extern char *ctlsock_path; #define dprintf(_f...) do { if (Debug) printf(_f); } while (0) @@ -56,7 +56,7 @@ extern int Startup; #define PFD_INET6 4 /* Offset of inet6 socket entry */ #define PFD_SENDSYS 5 /* Offset of sendsyslog(2) entry */ #define PFD_UNIX_0 6 /* Start of Unix socket entries */ -#define N_PFD (PFD_UNIX_0 + MAXFUNIX) /* # of pollfd entries */ +#define N_PFD (PFD_UNIX_0 + MAXUNIX) /* # of pollfd entries */ extern struct pollfd pfd[N_PFD]; struct ringbuf { |