aboutsummaryrefslogtreecommitdiff
path: root/initd/mksock.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-04-07 15:35:19 +0200
committerDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-04-07 16:19:38 +0200
commitb81668e045b6a2105b7b0b9e2e5afa8e631e6ec5 (patch)
tree6b37e483b49c52467a0ba1a62c416e2b5ada763f /initd/mksock.c
parent43274e3910d2a910262d1192e663db1d983f8e54 (diff)
Minor cleanup
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
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;