adns/adns-ocloexec.patch
Cristian Rodríguez 58fc7cd92f Accepting request 92977 from home:elvigia:branches:devel:libraries:c_c++
- Use O_CLOEXEC in library code.
- Change the visibility patch to not use the error prone 
  version-script but rather GCC visibility

OBS-URL: https://build.opensuse.org/request/show/92977
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/adns?expand=0&rev=10
2011-11-22 02:36:24 +00:00

32 lines
1.1 KiB
Diff

--- 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;