summaryrefslogtreecommitdiff
path: root/initd/mksock.c
diff options
context:
space:
mode:
Diffstat (limited to 'initd/mksock.c')
-rw-r--r--initd/mksock.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/initd/mksock.c b/initd/mksock.c
index 6a9cab0..0ec6b68 100644
--- a/initd/mksock.c
+++ b/initd/mksock.c
@@ -30,25 +30,14 @@
int mksock(void)
{
struct sockaddr_un un;
- int fd, flags;
+ int fd;
- fd = socket(AF_UNIX, SOCK_STREAM, 0);
+ fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (fd < 0) {
perror("socket");
return -1;
}
- flags = fcntl(fd, F_GETFD);
- if (flags == -1) {
- perror("socket F_GETFD");
- goto fail;
- }
-
- if (fcntl(fd, F_SETFD, flags | O_CLOEXEC)) {
- perror("socket F_SETFD");
- goto fail;
- }
-
memset(&un, 0, sizeof(un));
un.sun_family = AF_UNIX;