diff options
| author | 2015-10-11 20:23:49 +0000 | |
|---|---|---|
| committer | 2015-10-11 20:23:49 +0000 | |
| commit | e9bd15038d03da9cf122f415eea0029eda0acc88 (patch) | |
| tree | bd11aa13c278d8f69b5f845740bfccbf754330d8 /usr.sbin/syslogd/syslogd.c | |
| parent | Don't return errno from main() (diff) | |
| download | wireguard-openbsd-e9bd15038d03da9cf122f415eea0029eda0acc88.tar.xz wireguard-openbsd-e9bd15038d03da9cf122f415eea0029eda0acc88.zip | |
Userspace doesn't need to use SUN_LEN(): connect() and bind() must accept
sizeof(struct sockaddr_un), so do the simple, portable thing.
Also convert some strncpy() to strlcpy()
ok deraadt@
Diffstat (limited to 'usr.sbin/syslogd/syslogd.c')
| -rw-r--r-- | usr.sbin/syslogd/syslogd.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index a9364ebb317..4513772ea41 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syslogd.c,v 1.195 2015/10/10 20:35:01 deraadt Exp $ */ +/* $OpenBSD: syslogd.c,v 1.196 2015/10/11 20:23:49 guenther Exp $ */ /* * Copyright (c) 1983, 1988, 1993, 1994 @@ -491,9 +491,6 @@ main(int argc, char *argv[]) die(0); } -#ifndef SUN_LEN -#define SUN_LEN(unp) (strlen((unp)->sun_path) + 2) -#endif for (i = 0; i < nunix; i++) { fd_unix[i] = unix_socket(path_unix[i], SOCK_DGRAM, 0666); if (fd_unix[i] == -1) { @@ -2813,7 +2810,7 @@ unix_socket(char *path, int type, mode_t mode) old_umask = umask(0177); unlink(path); - if (bind(fd, (struct sockaddr *)&s_un, SUN_LEN(&s_un)) == -1) { + if (bind(fd, (struct sockaddr *)&s_un, sizeof(s_un)) == -1) { snprintf(ebuf, sizeof(ebuf), "cannot bind %s", path); logerror(ebuf); umask(old_umask); |
