summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd/control.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/ospfd/control.c')
-rw-r--r--usr.sbin/ospfd/control.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/ospfd/control.c b/usr.sbin/ospfd/control.c
index c426d270a98..20fec1d3ed7 100644
--- a/usr.sbin/ospfd/control.c
+++ b/usr.sbin/ospfd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.1 2005/01/28 14:05:40 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.2 2005/03/11 15:48:58 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -52,7 +52,6 @@ control_init(void)
return (-1);
}
- old_umask = umask(S_IXUSR|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH);
bzero(&sun, sizeof(sun));
sun.sun_family = AF_UNIX;
strlcpy(sun.sun_path, OSPFD_SOCKET, sizeof(sun.sun_path));
@@ -64,11 +63,14 @@ control_init(void)
return (-1);
}
+ old_umask = umask(S_IXUSR|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH);
if (bind(fd, (struct sockaddr *)&sun, sizeof(sun)) == -1) {
log_warn("control_init: bind: %s", OSPFD_SOCKET);
close(fd);
+ umask(old_umask);
return (-1);
}
+ umask(old_umask);
if (chmod(OSPFD_SOCKET, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) == -1) {
log_warn("control_init: chmod");
@@ -76,8 +78,6 @@ control_init(void)
return (-1);
}
- umask(old_umask);
-
session_socket_blockmode(fd, BM_NONBLOCK);
control_state.fd = fd;