]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 2565] Handle EINTR on getifaddrs()
authorHarlan Stenn <stenn@ntp.org>
Sat, 22 Feb 2014 05:25:52 +0000 (05:25 +0000)
committerHarlan Stenn <stenn@ntp.org>
Sat, 22 Feb 2014 05:25:52 +0000 (05:25 +0000)
bk: 530834e0T9mMEaY3cfMKBS1dwYmGcQ

ChangeLog
lib/isc/unix/ifiter_getifaddrs.c

index 399dcd8ae182d7fb5b2065d4fc31871f9857a8a1..86f70eda1374d1b5f9e274cc9a4a00bedcc21612 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+* [Bug 2565] Handle EINTR on getifaddrs().
 (4.2.7p422) 2014/02/17 Released by Harlan Stenn <stenn@ntp.org>
 * [Bug 2536] ntpd sandboxing support (libseccomp2).
 (4.2.7p421) 2014/02/10 Released by Harlan Stenn <stenn@ntp.org>
index 1fe5753560bbb74ddc0e26188c3062f9f88715e4..a15d21f500c08aa811c9c66e28724ba03972813f 100644 (file)
@@ -55,6 +55,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
        isc_interfaceiter_t *iter;
        isc_result_t result;
        char strbuf[ISC_STRERRORSIZE];
+       int trys;
 
        REQUIRE(mctx != NULL);
        REQUIRE(iterp != NULL);
@@ -86,17 +87,23 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
        iter->valid = ISC_R_FAILURE;
 #endif
 
-       if (getifaddrs(&iter->ifaddrs) < 0) {
-               isc__strerror(errno, strbuf, sizeof(strbuf));
-               UNEXPECTED_ERROR(__FILE__, __LINE__,
-                                isc_msgcat_get(isc_msgcat,
-                                               ISC_MSGSET_IFITERGETIFADDRS,
-                                               ISC_MSG_GETIFADDRS,
-                                               "getting interface "
-                                               "addresses: getifaddrs: %s"),
-                                strbuf);
-               result = ISC_R_UNEXPECTED;
-               goto failure;
+       for (trys = 0; trys < 3; trys++) {
+               if (getifaddrs(&iter->ifaddrs) < 0) {
+                       if (errno == EINTR)
+                               continue;
+
+                       isc__strerror(errno, strbuf, sizeof(strbuf));
+                       UNEXPECTED_ERROR(__FILE__, __LINE__,
+                                        isc_msgcat_get(isc_msgcat,
+                                                       ISC_MSGSET_IFITERGETIFADDRS,
+                                                       ISC_MSG_GETIFADDRS,
+                                                       "getting interface "
+                                                       "addresses: getifaddrs: %s"),
+                                        strbuf);
+                       result = ISC_R_UNEXPECTED;
+                       goto failure;
+               }
+               break;
        }
 
        /*