summaryrefslogtreecommitdiff
path: root/packaging/adns-ocloexec.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/adns-ocloexec.patch')
-rw-r--r--packaging/adns-ocloexec.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/packaging/adns-ocloexec.patch b/packaging/adns-ocloexec.patch
new file mode 100644
index 0000000..d89ef52
--- /dev/null
+++ b/packaging/adns-ocloexec.patch
@@ -0,0 +1,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;