summaryrefslogtreecommitdiff
path: root/packaging/adns-ocloexec.patch
blob: d89ef5285ecc65aed46d5306f91c762958f6846c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--- src/setup.c.orig
+++ src/setup.c
@@ -464,7 +464,7 @@ static const char *instrum_getenv(adns_s
 static void readconfig(adns_state ads, const char *filename, int warnmissing) {
   getline_ctx gl_ctx;
   
-  gl_ctx.file= fopen(filename,"r");
+  gl_ctx.file= fopen(filename,"re");
   if (!gl_ctx.file) {
     if (errno == ENOENT) {
       if (warnmissing)
@@ -572,7 +572,7 @@ static int init_finish(adns_state ads) {
   }
 
   proto= getprotobyname("udp"); if (!proto) { r= ENOPROTOOPT; goto x_free; }
-  ads->udpsocket= socket(AF_INET,SOCK_DGRAM,proto->p_proto);
+  ads->udpsocket= socket(AF_INET,SOCK_DGRAM|SOCK_CLOEXEC,proto->p_proto);
   if (ads->udpsocket<0) { r= errno; goto x_free; }
 
   r= adns__setnonblock(ads,ads->udpsocket);
--- src/event.c.orig
+++ src/event.c
@@ -123,7 +123,7 @@ void adns__tcp_tryconnect(adns_state ads
       adns__diag(ads,-1,0,"unable to find protocol no. for TCP !");
       return;
     }
-    fd= socket(AF_INET,SOCK_STREAM,proto->p_proto);
+    fd= socket(AF_INET,SOCK_STREAM|SOCK_CLOEXEC,proto->p_proto);
     if (fd<0) {
       adns__diag(ads,-1,0,"cannot create TCP socket: %s",strerror(errno));
       return;