Skip to content

Commit

Permalink
Set FD_CLOEXEC on socket.
Browse files Browse the repository at this point in the history
  • Loading branch information
Juliusz Chroboczek committed Apr 3, 2008
1 parent 67f8ce0 commit 52426b0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions net.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ babel_socket(int port)
if(rc < 0)
goto fail;

rc = fcntl(s, F_GETFD, 0);
if(rc < 0)
goto fail;

rc = fcntl(s, F_SETFD, rc | FD_CLOEXEC);
if(rc < 0)
goto fail;

memset(&sin6, 0, sizeof(sin6));
sin6.sin6_family = AF_INET6;
sin6.sin6_port = htons(port);
Expand Down

0 comments on commit 52426b0

Please sign in to comment.