chiark / gitweb /
Small modernizations
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 18 Jul 2014 18:01:13 +0000 (14:01 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 19 Jul 2014 01:45:27 +0000 (21:45 -0400)
src/journal/coredumpctl.c
src/journal/journald-native.c
src/login/logind-acl.c
src/login/logind-session.h

index d1450c0..e5f4d45 100644 (file)
@@ -131,11 +131,10 @@ static int add_match(Set *set, const char *match) {
                 goto fail;
 
         log_debug("Adding pattern: %s", pattern);
-        r = set_put(set, pattern);
+        r = set_consume(set, pattern);
         if (r < 0) {
                 log_error("Failed to add pattern '%s': %s",
                           pattern, strerror(-r));
-                free(pattern);
                 goto fail;
         }
 
index 0f3936a..d73280c 100644 (file)
@@ -383,12 +383,15 @@ void server_process_native_file(
 }
 
 int server_open_native_socket(Server*s) {
-        union sockaddr_union sa;
         int one, r;
 
         assert(s);
 
         if (s->native_fd < 0) {
+                union sockaddr_union sa = {
+                        .un.sun_family = AF_UNIX,
+                        .un.sun_path = "/run/systemd/journal/socket",
+                };
 
                 s->native_fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
                 if (s->native_fd < 0) {
@@ -396,10 +399,6 @@ int server_open_native_socket(Server*s) {
                         return -errno;
                 }
 
-                zero(sa);
-                sa.un.sun_family = AF_UNIX;
-                strncpy(sa.un.sun_path, "/run/systemd/journal/socket", sizeof(sa.un.sun_path));
-
                 unlink(sa.un.sun_path);
 
                 r = bind(s->native_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path));
index af7c352..b76e16d 100644 (file)
@@ -284,7 +284,7 @@ int devnode_acl_all(struct udev *udev,
                 k = devnode_acl(n, flush, del, old_uid, add, new_uid);
                 if (k == -ENOENT)
                         log_debug("Device %s disappeared while setting ACLs", n);
-                else if (k < 0)
+                else if (k < 0 && r == 0)
                         r = k;
         }
 
index 81957df..e62b76d 100644 (file)
@@ -72,7 +72,7 @@ enum KillWho {
 struct Session {
         Manager *manager;
 
-        char *id;
+        const char *id;
         unsigned int pos;
         SessionType type;
         SessionClass class;