[Openswan dev]
Re: [PATCH] Set CLOEXEC on all pluto file descriptors
Herbert Xu
herbert at gondor.apana.org.au
Thu Sep 8 14:38:01 CEST 2005
On Wed, Sep 07, 2005 at 04:48:03PM +0200, Ken Bantoft wrote:
>
> Thanks for both patches - we'll merge them in this week... and I *just*
> released 2.4.0rc6 about 10 minutes ago =)
Thanks Ken. I missed a file descriptor in the CLOEXEC patch so please
apply this one on top of it.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert at gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-------------- next part --------------
Index: programs/pluto/rcv_whack.c
===================================================================
RCS file: /var/cvs/snwb/packages/openswan/programs/pluto/rcv_whack.c,v
retrieving revision 1.2
diff -u -r1.2 rcv_whack.c
--- programs/pluto/rcv_whack.c 8 Sep 2005 00:31:07 -0000 1.2
+++ programs/pluto/rcv_whack.c 8 Sep 2005 03:13:59 -0000
@@ -29,6 +29,7 @@
#include <resolv.h>
#include <arpa/nameser.h> /* missing from <resolv.h> on old systems */
#include <sys/queue.h>
+#include <fcntl.h>
#include <openswan.h>
#include "pfkeyv2.h"
@@ -249,6 +250,12 @@
log_errno((e, "accept() failed in whack_handle()"));
return;
}
+ if (fcntl(whackfd, F_SETFD, FD_CLOEXEC) < 0)
+ {
+ log_errno((e, "failed to set CLOEXEC in whack_handle()"));
+ close(whackfd);
+ return;
+ }
n = read(whackfd, &msg, sizeof(msg));
if (n == -1)
{
More information about the Dev
mailing list