[socket_wrapper/el6] Try to fix false gcc warning.

asn asn at fedoraproject.org
Wed Oct 1 15:03:54 UTC 2014


commit 4b0386dc237a981e6677d85b6d275fd4b6aae50b
Author: Andreas Schneider <asn at cryptomilk.org>
Date:   Wed Oct 1 17:03:19 2014 +0200

    Try to fix false gcc warning.

 socket_wrapper.spec                             |    4 ++
 swrap-Fix-the-loop-for-older-gcc-versions.patch |   49 +++++++++++++++++++++++
 2 files changed, 53 insertions(+), 0 deletions(-)
---
diff --git a/socket_wrapper.spec b/socket_wrapper.spec
index bad6698..8e477cc 100644
--- a/socket_wrapper.spec
+++ b/socket_wrapper.spec
@@ -8,6 +8,8 @@ Url:            http://cwrap.org/
 
 Source0:        https://ftp.samba.org/pub/cwrap/%{name}-%{version}.tar.gz
 
+Patch0:         swrap-Fix-the-loop-for-older-gcc-versions.patch
+
 BuildRequires:  cmake28
 BuildRequires:  libcmocka-devel >= 0.4.1
 
@@ -28,6 +30,8 @@ development/testing.
 %prep
 %setup -q
 
+%patch0 -p1 -b .swrap-Fix-the-loop-for-older-gcc-versions.patch
+
 %build
 if test ! -e "obj"; then
     mkdir obj
diff --git a/swrap-Fix-the-loop-for-older-gcc-versions.patch b/swrap-Fix-the-loop-for-older-gcc-versions.patch
new file mode 100644
index 0000000..598a0af
--- /dev/null
+++ b/swrap-Fix-the-loop-for-older-gcc-versions.patch
@@ -0,0 +1,49 @@
+From 03572c6e09f0068a79f173fd3ee01968fa8e72f7 Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <asn at samba.org>
+Date: Wed, 1 Oct 2014 16:59:29 +0200
+Subject: [PATCH] swrap: Fix the loop for older gcc versions.
+
+Signed-off-by: Andreas Schneider <asn at samba.org>
+---
+ src/socket_wrapper.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
+index d5c343d..b30303f 100644
+--- a/src/socket_wrapper.c
++++ b/src/socket_wrapper.c
+@@ -452,11 +452,14 @@ static void *swrap_load_lib_handle(enum swrap_lib lib)
+ #ifdef HAVE_LIBSOCKET
+ 		handle = swrap.libsocket_handle;
+ 		if (handle == NULL) {
+-			for (handle = NULL, i = 10; handle == NULL && i >= 0; i--) {
++			for (i = 10; i >= 0; i--) {
+ 				char soname[256] = {0};
+ 
+ 				snprintf(soname, sizeof(soname), "libsocket.so.%d", i);
+ 				handle = dlopen(soname, flags);
++				if (handle != NULL) {
++					break;
++				}
+ 			}
+ 
+ 			swrap.libsocket_handle = handle;
+@@ -474,11 +477,14 @@ static void *swrap_load_lib_handle(enum swrap_lib lib)
+ 		}
+ #endif
+ 		if (handle == NULL) {
+-			for (handle = NULL, i = 10; handle == NULL && i >= 0; i--) {
++			for (i = 10; i >= 0; i--) {
+ 				char soname[256] = {0};
+ 
+ 				snprintf(soname, sizeof(soname), "libc.so.%d", i);
+ 				handle = dlopen(soname, flags);
++				if (handle != NULL) {
++					break;
++				}
+ 			}
+ 
+ 			swrap.libc_handle = handle;
+-- 
+2.1.0
+


More information about the scm-commits mailing list