summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2016-02-09 10:38:03 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2016-02-09 10:38:03 +0000
commit8ee90dca2d2d4ef271eb061ff0113bca3dcb8460 (patch)
tree2f51817f19d423e92161a96c060cbdb7b2c16a09 /usr.sbin
parentb8764c022869b4969d216f497e35a4dfc156530b (diff)
rename variable sun to s_un to ease portability
diff from Freddy DISSAUX, ok gilles@, jung@, sunil@, millert@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/smtpd/control.c22
-rw-r--r--usr.sbin/smtpd/smtpctl.c12
2 files changed, 17 insertions, 17 deletions
diff --git a/usr.sbin/smtpd/control.c b/usr.sbin/smtpd/control.c
index fafbe90aa47..1cf6eb0642d 100644
--- a/usr.sbin/smtpd/control.c
+++ b/usr.sbin/smtpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.110 2016/02/02 05:45:27 sunil Exp $ */
+/* $OpenBSD: control.c,v 1.111 2016/02/09 10:38:02 gilles Exp $ */
/*
* Copyright (c) 2012 Gilles Chehade <gilles@poolp.org>
@@ -202,20 +202,20 @@ control_sig_handler(int sig, short event, void *p)
int
control_create_socket(void)
{
- struct sockaddr_un sun;
+ struct sockaddr_un s_un;
int fd;
mode_t old_umask;
if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
fatal("control: socket");
- memset(&sun, 0, sizeof(sun));
- sun.sun_family = AF_UNIX;
- if (strlcpy(sun.sun_path, SMTPD_SOCKET,
- sizeof(sun.sun_path)) >= sizeof(sun.sun_path))
+ memset(&s_un, 0, sizeof(s_un));
+ s_un.sun_family = AF_UNIX;
+ if (strlcpy(s_un.sun_path, SMTPD_SOCKET,
+ sizeof(s_un.sun_path)) >= sizeof(s_un.sun_path))
fatal("control: socket name too long");
- if (connect(fd, (struct sockaddr *)&sun, sizeof(sun)) == 0)
+ if (connect(fd, (struct sockaddr *)&s_un, sizeof(s_un)) == 0)
fatalx("control socket already listening");
if (unlink(SMTPD_SOCKET) == -1)
@@ -223,7 +223,7 @@ control_create_socket(void)
fatal("control: cannot unlink socket");
old_umask = umask(S_IXUSR|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH);
- if (bind(fd, (struct sockaddr *)&sun, sizeof(sun)) == -1) {
+ if (bind(fd, (struct sockaddr *)&s_un, sizeof(s_un)) == -1) {
(void)umask(old_umask);
fatal("control: bind");
}
@@ -339,7 +339,7 @@ control_accept(int listenfd, short event, void *arg)
{
int connfd;
socklen_t len;
- struct sockaddr_un sun;
+ struct sockaddr_un s_un;
struct ctl_conn *c;
size_t *count;
uid_t euid;
@@ -348,8 +348,8 @@ control_accept(int listenfd, short event, void *arg)
if (getdtablesize() - getdtablecount() < CONTROL_FD_RESERVE)
goto pause;
- len = sizeof(sun);
- if ((connfd = accept(listenfd, (struct sockaddr *)&sun, &len)) == -1) {
+ len = sizeof(s_un);
+ if ((connfd = accept(listenfd, (struct sockaddr *)&s_un, &len)) == -1) {
if (errno == ENFILE || errno == EMFILE)
goto pause;
if (errno == EINTR || errno == EWOULDBLOCK ||
diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c
index 5f14062d7f7..7d064cab8cb 100644
--- a/usr.sbin/smtpd/smtpctl.c
+++ b/usr.sbin/smtpd/smtpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpctl.c,v 1.145 2016/02/03 08:03:21 gilles Exp $ */
+/* $OpenBSD: smtpctl.c,v 1.146 2016/02/09 10:38:02 gilles Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
@@ -104,17 +104,17 @@ void stat_decrement(const char *k, size_t v)
int
srv_connect(void)
{
- struct sockaddr_un sun;
+ struct sockaddr_un s_un;
int ctl_sock, saved_errno;
/* connect to smtpd control socket */
if ((ctl_sock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
err(1, "socket");
- memset(&sun, 0, sizeof(sun));
- sun.sun_family = AF_UNIX;
- (void)strlcpy(sun.sun_path, SMTPD_SOCKET, sizeof(sun.sun_path));
- if (connect(ctl_sock, (struct sockaddr *)&sun, sizeof(sun)) == -1) {
+ memset(&s_un, 0, sizeof(s_un));
+ s_un.sun_family = AF_UNIX;
+ (void)strlcpy(s_un.sun_path, SMTPD_SOCKET, sizeof(s_un.sun_path));
+ if (connect(ctl_sock, (struct sockaddr *)&s_un, sizeof(s_un)) == -1) {
saved_errno = errno;
close(ctl_sock);
errno = saved_errno;