chiark / gitweb /
fds: Provide cloexec() and use it in udp.c and tun.c
[secnet.git] / udp.c
diff --git a/udp.c b/udp.c
index 552a58e000d78d372cc5def7de0afa7512785ccb..bb82026c144d0df1f56f9f52e9401dd2fae91691 100644 (file)
--- a/udp.c
+++ b/udp.c
@@ -224,10 +224,7 @@ static void udp_phase_hook(void *sst, uint32_t new_phase)
        fatal_perror("udp (%s:%d): fcntl(set O_NONBLOCK)",
                     st->loc.file,st->loc.line);
     }
        fatal_perror("udp (%s:%d): fcntl(set O_NONBLOCK)",
                     st->loc.file,st->loc.line);
     }
-    if (fcntl(st->fd, F_SETFD, FD_CLOEXEC)==-1) {
-       fatal_perror("udp (%s:%d): fcntl(set FD_CLOEXEC)",
-                    st->loc.file,st->loc.line);
-    }
+    setcloexec(st->fd);
 
     FILLZERO(addr);
     addr.sin_family=AF_INET;
 
     FILLZERO(addr);
     addr.sin_family=AF_INET;