summaryrefslogtreecommitdiff
path: root/usr.sbin/apmd/apmd.c
diff options
context:
space:
mode:
authorbitblt <bitblt@cvs.openbsd.org>1997-04-13 02:52:16 +0000
committerbitblt <bitblt@cvs.openbsd.org>1997-04-13 02:52:16 +0000
commite450e98ca2eaff37bcbe3e19e11d7fcba68a3102 (patch)
tree82ee7bf6da5623eeab33abfe063d976cad902b2d /usr.sbin/apmd/apmd.c
parent5c6dd2c4ce4e4648eb9770a02c711071f9c0b8ab (diff)
Fixed socket permissions race at startup; corrected error message to
correctly reflect socket permissions.
Diffstat (limited to 'usr.sbin/apmd/apmd.c')
-rw-r--r--usr.sbin/apmd/apmd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.sbin/apmd/apmd.c b/usr.sbin/apmd/apmd.c
index d7456a68f7f..f63827331c1 100644
--- a/usr.sbin/apmd/apmd.c
+++ b/usr.sbin/apmd/apmd.c
@@ -153,10 +153,11 @@ bind_socket(const char *sockname)
s_un.sun_len = SUN_LEN(&s_un);
/* remove it if present, we're moving in */
(void) remove(sockname);
+ umask (077);
if (bind(sock, (struct sockaddr *)&s_un, s_un.sun_len) == -1)
err(1, "cannot connect to APM socket");
if (chmod(sockname, 0660) == -1 || chown(sockname, 0, 0) == -1)
- err(1, "cannot set socket mode/owner/group to 666/0/0");
+ err(1, "cannot set socket mode/owner/group to 660/0/0");
listen(sock, 1);
socketname = strdup(sockname);
atexit(sockunlink);