[systemd-commits] 2 commits - src/libsystemd

Tom Gundersen tomegun at kemper.freedesktop.org
Tue Jan 14 05:09:30 PST 2014


 src/libsystemd/sd-resolv.c |   31 +++++++------------------------
 1 file changed, 7 insertions(+), 24 deletions(-)

New commits:
commit 8c56c8bd319e419acbedf24b65bc008ad0e5b8b0
Author: Tom Gundersen <teg at jklm.no>
Date:   Tue Jan 14 13:51:18 2014 +0100

    sd-resolv: remove left-over comment
    
    We are anyway breaking the API by renaming everything, so that is not a concern.

diff --git a/src/libsystemd/sd-resolv.c b/src/libsystemd/sd-resolv.c
index 8845d6e..b8288ba 100644
--- a/src/libsystemd/sd-resolv.c
+++ b/src/libsystemd/sd-resolv.c
@@ -1111,11 +1111,6 @@ void sd_resolv_freeanswer(unsigned char *answer) {
         if (!answer)
                 return;
 
-        /* Please note that this function is new in libresolv 0.4. In
-         * older versions you were supposed to free the answer directly
-         * with free(). Hence, if this function is changed to do more than
-         * just a simple free() this must be considered ABI/API breakage! */
-
         free(answer);
 
         errno = saved_errno;

commit 8a6233fb653098c14d84430b3516edd63265d405
Author: Tom Gundersen <teg at jklm.no>
Date:   Tue Jan 14 13:50:35 2014 +0100

    sd-resolv: require SOCK_CLOEXEC

diff --git a/src/libsystemd/sd-resolv.c b/src/libsystemd/sd-resolv.c
index aa97ef7..8845d6e 100644
--- a/src/libsystemd/sd-resolv.c
+++ b/src/libsystemd/sd-resolv.c
@@ -415,8 +415,8 @@ static void* thread_worker(void *p) {
 }
 
 sd_resolv_t* sd_resolv_new(unsigned n_proc) {
-        int i;
         sd_resolv_t *resolv = NULL;
+        int i, r;
 
         assert(n_proc >= 1);
 
@@ -437,27 +437,15 @@ sd_resolv_t* sd_resolv_new(unsigned n_proc) {
 
         memset(resolv->queries, 0, sizeof(resolv->queries));
 
-#ifdef SOCK_CLOEXEC
-        if (socketpair(PF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0, resolv->fds) < 0 ||
-                        socketpair(PF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0, resolv->fds+2) < 0) {
-
-                /* Try again, without SOCK_CLOEXEC */
-                if (errno == EINVAL) {
-#endif
-                        if (socketpair(PF_UNIX, SOCK_DGRAM, 0, resolv->fds) < 0 ||
-                                        socketpair(PF_UNIX, SOCK_DGRAM, 0, resolv->fds+2) < 0)
-                                goto fail;
-#ifdef SOCK_CLOEXEC
-                } else
-                        goto fail;
-        }
-#endif
+        r = socketpair(PF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0, resolv->fds);
+        if (r < 0)
+                goto fail;
 
-        for (i = 0; i < MESSAGE_FD_MAX; i++)
-                fd_cloexec(resolv->fds[i], true);
+        r = socketpair(PF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0, resolv->fds+2);
+        if (r < 0)
+                goto fail;
 
         for (resolv->valid_workers = 0; resolv->valid_workers < n_proc; resolv->valid_workers++) {
-                int r;
                 r = pthread_create(&resolv->workers[resolv->valid_workers], NULL, thread_worker, resolv);
                 if (r) {
                         errno = r;



More information about the systemd-commits mailing list