summaryrefslogtreecommitdiff
path: root/usr.bin/aucat/listen.c
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2008-10-29 22:40:57 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2008-10-29 22:40:57 +0000
commit28a1170c0535152cffafff212dcbbb63d2cc00af (patch)
tree01466ee2c71b396748a2da2225ebe8a919b15c2b /usr.bin/aucat/listen.c
parent7a952663e8796747babbe5c2eac9aa36951d7239 (diff)
chmod(2) the aucat socket, as if aucat(1) was started with
umask = 0, this allows one user to start the server and another user to use it (eg. _mpd). ok todd, deraadt, jakemsr
Diffstat (limited to 'usr.bin/aucat/listen.c')
-rw-r--r--usr.bin/aucat/listen.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/aucat/listen.c b/usr.bin/aucat/listen.c
index 1e63c4b4dc3..2e73147e34a 100644
--- a/usr.bin/aucat/listen.c
+++ b/usr.bin/aucat/listen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: listen.c,v 1.1 2008/10/26 08:49:44 ratchov Exp $ */
+/* $OpenBSD: listen.c,v 1.2 2008/10/29 22:40:56 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -16,6 +16,7 @@
*/
#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/stat.h>
#include <sys/un.h>
#include <err.h>
@@ -67,6 +68,10 @@ listen_new(struct fileops *ops, char *path)
perror("bind");
exit(1);
}
+ if (chmod(sockname.sun_path, 0777) < 0) {
+ /* not fatal, just print error */
+ perror(sockname.sun_path);
+ }
if (listen(sock, 1) < 0) {
perror("listen");
exit(1);