[systemd-commits] 2 commits - src/libsystemd-bus src/locale

Lennart Poettering lennart at kemper.freedesktop.org
Wed Apr 10 14:23:40 PDT 2013


 src/libsystemd-bus/bus-message.c   |    7 +------
 src/libsystemd-bus/test-bus-chat.c |    2 --
 src/locale/localectl.c             |    4 ++++
 3 files changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 0affed79d2e30013f07cb94e6f07e3fcb81c02fa
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Apr 10 23:21:53 2013 +0200

    localctl: skip locale entries with non-UTF8 names
    
    glibc should place these in the locale archive. For now, let's just skip
    them from our output, since they are aliases anyway.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=63389

diff --git a/src/locale/localectl.c b/src/locale/localectl.c
index 5328ac4..095d7f7 100644
--- a/src/locale/localectl.c
+++ b/src/locale/localectl.c
@@ -37,6 +37,7 @@
 #include "pager.h"
 #include "set.h"
 #include "path-util.h"
+#include "utf8.h"
 
 static bool arg_no_pager = false;
 static enum transport {
@@ -359,6 +360,9 @@ static int add_locales_from_archive(Set *locales) {
                 if (e[i].locrec_offset == 0)
                         continue;
 
+                if (!utf8_is_valid((char*) p + e[i].name_offset))
+                        continue;
+
                 z = strdup((char*) p + e[i].name_offset);
                 if (!z) {
                         r = log_oom();

commit 1ef2af5ae02aede39262dedd9fd358b607450662
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Apr 10 23:04:20 2013 +0200

    bus: when we unmarshal an fd it should stay owned by the message object
    
    If the user wants the fd to stay valid he should keep a reference to the
    message object or duplicate the fd.
    
    This unifies behaviour of demarshalling data fields and unix fds.

diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index fb63a2d..3081664 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -1710,18 +1710,13 @@ int sd_bus_message_read_basic(sd_bus_message *m, char type, void *p) {
                         break;
 
                 case SD_BUS_TYPE_UNIX_FD: {
-                        int copy;
                         uint32_t j;
 
                         j = BUS_MESSAGE_BSWAP32(m, *(uint32_t*) q);
                         if (j >= m->n_fds)
                                 return -EBADMSG;
 
-                        copy = fcntl(m->fds[j], F_DUPFD_CLOEXEC, 3);
-                        if (copy < 0)
-                                return -errno;
-
-                        *(int*) p = copy;
+                        *(int*) p = m->fds[j];
                         break;
                 }
 
diff --git a/src/libsystemd-bus/test-bus-chat.c b/src/libsystemd-bus/test-bus-chat.c
index 533d78c..371c7a7 100644
--- a/src/libsystemd-bus/test-bus-chat.c
+++ b/src/libsystemd-bus/test-bus-chat.c
@@ -230,8 +230,6 @@ static int server(sd_bus *bus) {
                                 goto fail;
                         }
 
-                        close_nointr_nofail(fd);
-
                         r = sd_bus_reply_method_return(bus, m, NULL);
                         if (r < 0) {
                                 log_error("Failed to send reply: %s", strerror(-r));



More information about the systemd-commits mailing list