chiark
/
gitweb
/
~mdw
/
tripe
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
efd6c9e
)
Make file descriptors be nonblocking and close-on-exec.
author
mdw
<mdw>
Sun, 4 Feb 2001 17:10:58 +0000
(17:10 +0000)
committer
mdw
<mdw>
Sun, 4 Feb 2001 17:10:58 +0000
(17:10 +0000)
peer.c
patch
|
blob
|
blame
|
history
tun-unet.c
patch
|
blob
|
blame
|
history
diff --git
a/peer.c
b/peer.c
index 31aa1e28a14e1bc34aa85590656cd25823a38bf7..937d29f2b3c66b4b034f3bb2c8334f9eba9e8c6a 100644
(file)
--- a/
peer.c
+++ b/
peer.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: peer.c,v 1.
2 2001/02/03 22:40:29
mdw Exp $
+ * $Id: peer.c,v 1.
3 2001/02/04 17:10:58
mdw Exp $
*
* Communication with the peer
*
*
* Communication with the peer
*
@@
-29,6
+29,9
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: peer.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: peer.c,v $
+ * Revision 1.3 2001/02/04 17:10:58 mdw
+ * Make file descriptors be nonblocking and close-on-exec.
+ *
* Revision 1.2 2001/02/03 22:40:29 mdw
* Put timer information into the entropy pool when packets are received
* and on similar events. Reseed the generator on the interval timer.
* Revision 1.2 2001/02/03 22:40:29 mdw
* Put timer information into the entropy pool when packets are received
* and on similar events. Reseed the generator on the interval timer.
@@
-252,6
+255,7
@@
void p_init(unsigned port)
sin.sin_port = htons(port);
if (bind(fd, (struct sockaddr *)&sin, sizeof(sin)))
die(EXIT_FAILURE, "bind failed: %s", strerror(errno));
sin.sin_port = htons(port);
if (bind(fd, (struct sockaddr *)&sin, sizeof(sin)))
die(EXIT_FAILURE, "bind failed: %s", strerror(errno));
+ fdflags(fd, O_NONBLOCK, O_NONBLOCK, FD_CLOEXEC, FD_CLOEXEC);
sel_initfile(&sel, &sock, fd, SEL_READ, p_read, 0);
sel_addfile(&sock);
T( trace(T_PEER, "peer: created socket"); )
sel_initfile(&sel, &sock, fd, SEL_READ, p_read, 0);
sel_addfile(&sock);
T( trace(T_PEER, "peer: created socket"); )
diff --git
a/tun-unet.c
b/tun-unet.c
index d78c9a11fc86cc5d2e39007bba692ccf990ea831..57e1397d6061feab98c51b603f90188a5038b214 100644
(file)
--- a/
tun-unet.c
+++ b/
tun-unet.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: tun-unet.c,v 1.
1 2001/02/03 20:26:37
mdw Exp $
+ * $Id: tun-unet.c,v 1.
2 2001/02/04 17:10:58
mdw Exp $
*
* Tunnel interface based on Linux Usernet
*
*
* Tunnel interface based on Linux Usernet
*
@@
-29,6
+29,9
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: tun-unet.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: tun-unet.c,v $
+ * Revision 1.2 2001/02/04 17:10:58 mdw
+ * Make file descriptors be nonblocking and close-on-exec.
+ *
* Revision 1.1 2001/02/03 20:26:37 mdw
* Initial checkin.
*
* Revision 1.1 2001/02/03 20:26:37 mdw
* Initial checkin.
*
@@
-106,6
+109,7
@@
int tun_create(tunnel *t, peer *p)
a_warn("open `/dev/unet' failed: %s", strerror(errno));
return (-1);
}
a_warn("open `/dev/unet' failed: %s", strerror(errno));
return (-1);
}
+ fdflags(fd, O_NONBLOCK, O_NONBLOCK, FD_CLOEXEC, FD_CLOEXEC);
t->p = p;
sel_initfile(&sel, &t->f, fd, SEL_READ, t_read, t);
sel_addfile(&t->f);
t->p = p;
sel_initfile(&sel, &t->f, fd, SEL_READ, t_read, t);
sel_addfile(&t->f);