SHA256
1
0
forked from pool/adns

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
This commit is contained in:
Cristian Rodríguez 2011-11-22 02:36:24 +00:00 committed by Git OBS Bridge
parent 8162ab54e3
commit 58fc7cd92f
4 changed files with 55 additions and 46 deletions

31
adns-ocloexec.patch Normal file
View File

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

View File

@ -11,50 +11,19 @@
AC_PROG_CPP
AC_PROG_RANLIB
AC_PROG_INSTALL
@@ -252,7 +254,7 @@ SHLIBSONAME='$(SHLIBFORLINK).$(MAJOR)'
SHLIBFILE='$(SHLIBSONAME).$(MINOR)'
--- src/internal.h.orig
+++ src/internal.h
@@ -49,6 +49,7 @@ typedef unsigned char byte;
# include "hredirect.h"
#endif
SHLIBCC='$(CC) $(CFLAGS) -fpic'
-MKSHLIB_1='$(CC) $(LDFLAGS) -shared -Wl,-soname=$(SHLIBSONAME) -o'
+MKSHLIB_1='$(CC) $(LDFLAGS) -shared -Wl,-soname=$(SHLIBSONAME),-version-script=$(srcdir)/../adns.sym -o'
MKSHLIB_2=''
MKSHLIB_3='-lc'
+#pragma GCC visibility push(hidden)
/* Configuration and constants */
--- /dev/null
+++ adns.sym
@@ -0,0 +1,35 @@
+{
+ global:
+adns_afterselect;
+adns_beforepoll;
+adns_beforeselect;
+adns_cancel;
+adns_check;
+adns_checkconsistency;
+adns_errabbrev;
+adns_errtypeabbrev;
+adns_finish;
+adns_firsttimeout;
+adns_forallqueries_begin;
+adns_forallqueries_next;
+adns_getaddrinfo;
+adns_globalsystemfailure;
+adns_init;
+adns_init_logfn;
+adns_init_strcfg;
+adns_processany;
+adns_processexceptional;
+adns_processreadable;
+adns_processtimeouts;
+adns_processwriteable;
+adns_rr_info;
+adns_strerror;
+adns_submit;
+adns_submit_reverse;
+adns_submit_reverse_any;
+adns_synchronous;
+adns_wait;
+adns_wait_poll;
+
+local: *;
+};
#define MAXSERVERS 5
@@ -803,4 +804,5 @@ static inline int errno_resources(int e)
(tv)|=GETIL_B(cb), \
(tv) )
+#pragma GCC visibility pop
#endif

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Nov 22 02:23:10 UTC 2011 - crrodriguez@opensuse.org
- Use O_CLOEXEC in library code.
- Change the visibility patch to not use the error prone
version-script but rather GCC visibility
-------------------------------------------------------------------
Fri Sep 16 19:06:22 UTC 2011 - jengelh@medozas.de

View File

@ -32,6 +32,7 @@ Patch0: %{name}-%{version}-destdir.patch
Patch1: %{name}-%{version}-configure.patch
Patch2: %{name}-%{version}-ipv6.patch
Patch3: adns-visibility.patch
Patch4: adns-ocloexec.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@ -65,6 +66,7 @@ programs with libads support.
%patch1
%patch2
%patch3
%patch4
cp %{S:1} .
%build
@ -79,7 +81,7 @@ rm %{buildroot}%{_libdir}/*.a
%check
# disable check for ipv6 patch
# make check
#make check
%files
%defattr(-,root,root)