From f7829ab936b21a6d4d9dc10c6ce44fbf489a34b6 Mon Sep 17 00:00:00 2001 From: bitblt Date: Sun, 13 Apr 1997 02:52:15 +0000 Subject: [PATCH] Fixed socket permissions race at startup; corrected error message to correctly reflect socket permissions. --- usr.sbin/apmd/apmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- 2.20.1