[systemd-commits] 9 commits - NEWS src/backlight src/boot src/cgtop src/core src/hostname src/journal src/libsystemd src/login src/machine src/network src/nspawn src/shared src/test src/timedate src/tmpfiles src/tty-ask-password-agent src/udev

Lennart Poettering lennart at kemper.freedesktop.org
Wed Feb 19 17:53:53 CET 2014


 NEWS                                                |    4 ++
 src/backlight/backlight.c                           |    2 -
 src/boot/boot-efi.c                                 |    2 -
 src/cgtop/cgtop.c                                   |    2 -
 src/core/dbus-manager.c                             |    2 -
 src/core/execute.c                                  |   16 ++---------
 src/hostname/hostnamectl.c                          |    2 -
 src/journal/journal-gatewayd.c                      |    4 +-
 src/journal/journalctl.c                            |    2 -
 src/journal/sd-journal.c                            |   20 +++++++------
 src/libsystemd/sd-bus/bus-control.c                 |    4 +-
 src/libsystemd/sd-bus/bus-message.c                 |    2 -
 src/libsystemd/sd-bus/test-bus-memfd.c              |    2 -
 src/libsystemd/sd-event/sd-event.c                  |    4 +-
 src/libsystemd/sd-event/test-event.c                |    4 +-
 src/libsystemd/sd-id128/sd-id128.c                  |   16 ++---------
 src/login/logind-session.c                          |    4 +-
 src/login/test-login.c                              |    2 -
 src/machine/machine.c                               |    4 +-
 src/network/networkd-link.c                         |    2 -
 src/nspawn/nspawn.c                                 |    2 -
 src/shared/acpi-fpdt.c                              |    2 -
 src/shared/boot-timestamps.c                        |    2 -
 src/shared/efivars.c                                |    4 +-
 src/shared/sleep-config.c                           |    4 +-
 src/shared/socket-util.c                            |    2 -
 src/shared/util.c                                   |   29 ++++++--------------
 src/test/test-cgroup-mask.c                         |    2 -
 src/test/test-sched-prio.c                          |    2 -
 src/test/test-unit-name.c                           |    2 -
 src/test/test-util.c                                |    4 +-
 src/timedate/timedatectl.c                          |    9 ++----
 src/tmpfiles/tmpfiles.c                             |    4 --
 src/tty-ask-password-agent/tty-ask-password-agent.c |    2 -
 src/udev/udev-ctrl.c                                |    2 -
 src/udev/udevadm-hwdb.c                             |   11 +++----
 36 files changed, 77 insertions(+), 106 deletions(-)

New commits:
commit e26da2dcea2f56461a8411e64d046cb5d903275c
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 19 17:52:41 2014 +0100

    tmpfiles: simplification

diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index b0efa37..6e36dc7 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -731,7 +731,7 @@ static int create_item(Item *i) {
                 break;
 
         case CREATE_SYMLINK: {
-                char *x;
+                _cleanup_free_ char *x = NULL;
 
                 label_context_set(i->path, S_IFLNK);
                 r = symlink(i->argument, i->path);
@@ -751,12 +751,10 @@ static int create_item(Item *i) {
                 }
 
                 if (!streq(i->argument, x)) {
-                        free(x);
                         log_error("%s is not the right symlinks.", i->path);
                         return -EEXIST;
                 }
 
-                free(x);
                 break;
         }
 

commit 833fce2857bcf9cba316d3f8c37af8997b6a80ab
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 19 17:52:28 2014 +0100

    util: simplify get_ctty()

diff --git a/src/shared/util.c b/src/shared/util.c
index 35e4338..b33f120 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -2526,9 +2526,11 @@ int get_ctty_devnr(pid_t pid, dev_t *d) {
 }
 
 int get_ctty(pid_t pid, dev_t *_devnr, char **r) {
-        int k;
-        char fn[sizeof("/dev/char/")-1 + 2*DECIMAL_STR_MAX(unsigned) + 1 + 1], *s, *b, *p;
+        char fn[sizeof("/dev/char/")-1 + 2*DECIMAL_STR_MAX(unsigned) + 1 + 1], *b = NULL;
+        _cleanup_free_ char *s = NULL;
+        const char *p;
         dev_t devnr;
+        int k;
 
         assert(r);
 
@@ -2546,14 +2548,8 @@ int get_ctty(pid_t pid, dev_t *_devnr, char **r) {
 
                 /* This is an ugly hack */
                 if (major(devnr) == 136) {
-                        if (asprintf(&b, "pts/%lu", (unsigned long) minor(devnr)) < 0)
-                                return -ENOMEM;
-
-                        *r = b;
-                        if (_devnr)
-                                *_devnr = devnr;
-
-                        return 0;
+                        asprintf(&b, "pts/%lu", (unsigned long) minor(devnr));
+                        goto finish;
                 }
 
                 /* Probably something like the ptys which have no
@@ -2561,14 +2557,7 @@ int get_ctty(pid_t pid, dev_t *_devnr, char **r) {
                  * vaguely useful. */
 
                 b = strdup(fn + 5);
-                if (!b)
-                        return -ENOMEM;
-
-                *r = b;
-                if (_devnr)
-                        *_devnr = devnr;
-
-                return 0;
+                goto finish;
         }
 
         if (startswith(s, "/dev/"))
@@ -2579,8 +2568,8 @@ int get_ctty(pid_t pid, dev_t *_devnr, char **r) {
                 p = s;
 
         b = strdup(p);
-        free(s);
 
+finish:
         if (!b)
                 return -ENOMEM;
 

commit 480a61ae742378a6a9a0eb84cf29c6c1e4ea22ff
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 19 17:51:54 2014 +0100

    timedatectl: fix minor memory leak

diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c
index 2c24b78..089a5fe 100644
--- a/src/timedate/timedatectl.c
+++ b/src/timedate/timedatectl.c
@@ -99,10 +99,10 @@ static void print_status_info(const StatusInfo *i) {
         struct tm tm;
         time_t sec;
         bool have_time = false;
-        char *zc, *zn;
+        _cleanup_free_ char *zc = NULL, *zn = NULL;
         time_t t, tc, tn;
-        int dn;
-        bool is_dstc, is_dstn;
+        int dn = 0;
+        bool is_dstc = false, is_dstn = false;
         int r;
 
         assert(i);
@@ -193,9 +193,6 @@ static void print_status_info(const StatusInfo *i) {
                        "                  %s\n"
                        "                  %s\n",
                        is_dstn ? "begins" : "ends", jump_str(dn, s, sizeof(s)), a, b);
-
-                free(zc);
-                free(zn);
         } else
                 printf("      DST active: %s\n", yes_no(is_dstc));
 

commit d4f1ef4437e59b2cb69a201bb086ab23070ea72d
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 19 17:51:08 2014 +0100

    udev: make sure we always return a valid error code in trie_store()

diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c
index 16abbe8..65cbf61 100644
--- a/src/udev/udevadm-hwdb.c
+++ b/src/udev/udevadm-hwdb.c
@@ -341,7 +341,7 @@ static int trie_store(struct trie *trie, const char *filename) {
         struct trie_f t = {
                 .trie = trie,
         };
-        char *filename_tmp;
+        _cleanup_free_ char *filename_tmp = NULL;
         int64_t pos;
         int64_t root_off;
         int64_t size;
@@ -385,8 +385,8 @@ static int trie_store(struct trie *trie, const char *filename) {
                 err = -errno;
         fclose(t.f);
         if (err < 0 || rename(filename_tmp, filename) < 0) {
-                unlink(filename_tmp);
-                goto out;
+                unlink_noerrno(filename_tmp);
+                return err < 0 ? err : -errno;
         }
 
         log_debug("=== trie on-disk ===");
@@ -400,9 +400,8 @@ static int trie_store(struct trie *trie, const char *filename) {
                   t.values_count * sizeof(struct trie_value_entry_f), t.values_count);
         log_debug("string store:     %8zu bytes", trie->strings->len);
         log_debug("strings start:    %8"PRIu64, t.strings_off);
-out:
-        free(filename_tmp);
-        return err;
+
+        return 0;
 }
 
 static int insert_data(struct trie *trie, struct udev_list *match_list,

commit 0f0e240cb8625d832e760ef32ed772e21c316905
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 19 17:50:15 2014 +0100

    sd-id128: use new dev_urandom() call

diff --git a/src/libsystemd/sd-id128/sd-id128.c b/src/libsystemd/sd-id128/sd-id128.c
index 9ee40ab..a1e44e6 100644
--- a/src/libsystemd/sd-id128/sd-id128.c
+++ b/src/libsystemd/sd-id128/sd-id128.c
@@ -208,22 +208,14 @@ _public_ int sd_id128_get_boot(sd_id128_t *ret) {
 }
 
 _public_ int sd_id128_randomize(sd_id128_t *ret) {
-        _cleanup_close_ int fd = -1;
         sd_id128_t t;
-        ssize_t k;
+        int r;
 
         assert_return(ret, -EINVAL);
 
-        fd = open("/dev/urandom", O_RDONLY|O_CLOEXEC|O_NOCTTY);
-        if (fd < 0)
-                return -errno;
-
-        k = loop_read(fd, &t, 16, false);
-        if (k < 0)
-                return (int) k;
-
-        if (k != 16)
-                return -EIO;
+        r = dev_urandom(&t, sizeof(t));
+        if (r < 0)
+                return r;
 
         /* Turn this into a valid v4 UUID, to be nice. Note that we
          * only guarantee this for newly generated UUIDs, not for

commit 581483bf59ea62147739e71dd2216477be03411c
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 19 17:49:50 2014 +0100

    journal: don't clobber return parameters of sd_journal_get_cutoff_realtime_usec() on failure

diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index fa2009c..831ab6b 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -2347,6 +2347,7 @@ _public_ int sd_journal_get_cutoff_realtime_usec(sd_journal *j, uint64_t *from,
         Iterator i;
         JournalFile *f;
         bool first = true;
+        uint64_t fmin = 0, tmax = 0;
         int r;
 
         assert_return(j, -EINVAL);
@@ -2366,19 +2367,20 @@ _public_ int sd_journal_get_cutoff_realtime_usec(sd_journal *j, uint64_t *from,
                         continue;
 
                 if (first) {
-                        if (from)
-                                *from = fr;
-                        if (to)
-                                *to = t;
+                        fmin = fr;
+                        tmax = t;
                         first = false;
                 } else {
-                        if (from)
-                                *from = MIN(fr, *from);
-                        if (to)
-                                *to = MAX(t, *to);
+                        fmin = MIN(fr, fmin);
+                        tmax = MAX(t, tmax);
                 }
         }
 
+        if (from)
+                *from = fmin;
+        if (to)
+                *to = tmax;
+
         return first ? 0 : 1;
 }
 

commit 1756a0118ea1ab25fd46c853e89853c7e4b3038c
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 19 17:49:00 2014 +0100

    execute: modernizations

diff --git a/src/core/execute.c b/src/core/execute.c
index 8bfe186..f8b7521 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -1977,27 +1977,20 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
                         fprintf(f, "%s%s: %llu\n", prefix, rlimit_to_string(i), (unsigned long long) c->rlimit[i]->rlim_max);
 
         if (c->ioprio_set) {
-                char *class_str;
-                int r;
+                _cleanup_free_ char *class_str = NULL;
 
-                r = ioprio_class_to_string_alloc(IOPRIO_PRIO_CLASS(c->ioprio), &class_str);
-                if (r < 0)
-                        class_str = NULL;
+                ioprio_class_to_string_alloc(IOPRIO_PRIO_CLASS(c->ioprio), &class_str);
                 fprintf(f,
                         "%sIOSchedulingClass: %s\n"
                         "%sIOPriority: %i\n",
                         prefix, strna(class_str),
                         prefix, (int) IOPRIO_PRIO_DATA(c->ioprio));
-                free(class_str);
         }
 
         if (c->cpu_sched_set) {
-                char *policy_str;
-                int r;
+                _cleanup_free_ char *policy_str = NULL;
 
-                r = sched_policy_to_string_alloc(c->cpu_sched_policy, &policy_str);
-                if (r < 0)
-                        policy_str = NULL;
+                sched_policy_to_string_alloc(c->cpu_sched_policy, &policy_str);
                 fprintf(f,
                         "%sCPUSchedulingPolicy: %s\n"
                         "%sCPUSchedulingPriority: %i\n"
@@ -2005,7 +1998,6 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
                         prefix, strna(policy_str),
                         prefix, c->cpu_sched_priority,
                         prefix, yes_no(c->cpu_sched_reset_on_fork));
-                free(policy_str);
         }
 
         if (c->cpuset) {

commit 39883f622f392d8579f4428fc5a789a102efbb10
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 19 17:47:11 2014 +0100

    make gcc shut up
    
    If -flto is used then gcc will generate a lot more warnings than before,
    among them a number of use-without-initialization warnings. Most of them
    without are false positives, but let's make them go away, because it
    doesn't really matter.

diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
index 7d7c084..86f10cc 100644
--- a/src/backlight/backlight.c
+++ b/src/backlight/backlight.c
@@ -64,7 +64,7 @@ static struct udev_device *find_pci_or_platform_parent(struct udev_device *devic
 
                 value = udev_device_get_sysattr_value(parent, "class");
                 if (value) {
-                        unsigned long class;
+                        unsigned long class = 0;
 
                         if (safe_atolu(value, &class) < 0) {
                                 log_warning("Cannot parse PCI class %s of device %s:%s.", value, subsystem, sysname);
diff --git a/src/boot/boot-efi.c b/src/boot/boot-efi.c
index 4266525..bd0c59b 100644
--- a/src/boot/boot-efi.c
+++ b/src/boot/boot-efi.c
@@ -50,7 +50,7 @@ static char *tilt_slashes(char *s) {
 }
 
 static int get_boot_entries(struct boot_info *info) {
-        uint16_t *list;
+        uint16_t *list = NULL;
         int i, n;
         int err = 0;
 
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index c56f7a8..fd0023b 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -98,7 +98,7 @@ static void group_hashmap_free(Hashmap *h) {
 static int process(const char *controller, const char *path, Hashmap *a, Hashmap *b, unsigned iteration) {
         Group *g;
         int r;
-        FILE *f;
+        FILE *f = NULL;
         pid_t pid;
         unsigned n;
 
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 6abd599..a9b8fad 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -873,7 +873,7 @@ static int method_create_snapshot(sd_bus *bus, sd_bus_message *message, void *us
         Manager *m = userdata;
         const char *name;
         int cleanup;
-        Snapshot *s;
+        Snapshot *s = NULL;
         int r;
 
         assert(bus);
diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index 3150396..afbf37d 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -69,7 +69,7 @@ typedef struct StatusInfo {
 } StatusInfo;
 
 static void print_status_info(StatusInfo *i) {
-        sd_id128_t mid, bid;
+        sd_id128_t mid = {}, bid = {};
         int r;
         const char *id = NULL;
         _cleanup_free_ char *pretty_name = NULL, *cpe_name = NULL;
diff --git a/src/journal/journal-gatewayd.c b/src/journal/journal-gatewayd.c
index 5c35d8e..7e97a35 100644
--- a/src/journal/journal-gatewayd.c
+++ b/src/journal/journal-gatewayd.c
@@ -744,7 +744,7 @@ static int request_handler_file(
 
 static int get_virtualization(char **v) {
         _cleanup_bus_unref_ sd_bus *bus = NULL;
-        char *b;
+        char *b = NULL;
         int r;
 
         r = sd_bus_default_system(&bus);
@@ -780,7 +780,7 @@ static int request_handler_machine(
         RequestMeta *m = connection_cls;
         int r;
         _cleanup_free_ char* hostname = NULL, *os_name = NULL;
-        uint64_t cutoff_from, cutoff_to, usage;
+        uint64_t cutoff_from = 0, cutoff_to = 0, usage;
         char *json;
         sd_id128_t mid, bid;
         _cleanup_free_ char *v = NULL;
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index d406dae..a328ba1 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -1651,7 +1651,7 @@ int main(int argc, char *argv[]) {
         }
 
         if (arg_action == ACTION_DISK_USAGE) {
-                uint64_t bytes;
+                uint64_t bytes = 0;
                 char sbytes[FORMAT_BYTES_MAX];
 
                 r = sd_journal_get_usage(j, &bytes);
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 6abbacf..fa2009c 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -1281,7 +1281,7 @@ static bool file_type_wanted(int flags, const char *filename) {
 }
 
 static int add_any_file(sd_journal *j, const char *path) {
-        JournalFile *f;
+        JournalFile *f = NULL;
         int r;
 
         assert(j);
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index 846307d..b4dbb5b 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -687,8 +687,8 @@ static int bus_get_owner_dbus1(
                 }
 
                 if (mask & SD_BUS_CREDS_SELINUX_CONTEXT) {
-                        const void *p;
-                        size_t sz;
+                        const void *p = NULL;
+                        size_t sz = 0;
 
                         r = sd_bus_call_method(
                                         bus,
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
index 3234134..fe84f3f 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
@@ -1863,7 +1863,7 @@ _public_ int sd_bus_message_open_container(
         struct bus_container *c, *w;
         uint32_t *array_size = NULL;
         char *signature;
-        size_t before, begin;
+        size_t before, begin = 0;
         bool need_offsets = false;
         int r;
 
diff --git a/src/libsystemd/sd-bus/test-bus-memfd.c b/src/libsystemd/sd-bus/test-bus-memfd.c
index f7197ed..f0f08ba 100644
--- a/src/libsystemd/sd-bus/test-bus-memfd.c
+++ b/src/libsystemd/sd-bus/test-bus-memfd.c
@@ -33,7 +33,7 @@ int main(int argc, char *argv[]) {
         char *s, *name;
         uint64_t sz;
         int r, fd;
-        FILE *f;
+        FILE *f = NULL;
         char buf[3] = {};
         struct iovec iov[3] = {};
         char bufv[3][3] = {};
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index cf2efa6..cda92e2 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -642,9 +642,9 @@ static int event_setup_timer_fd(
                 int *timer_fd,
                 clockid_t id) {
 
+        sd_id128_t bootid = {};
         struct epoll_event ev = {};
         int r, fd;
-        sd_id128_t bootid;
 
         assert(e);
         assert(timer_fd);
@@ -2126,7 +2126,7 @@ _public_ int sd_event_get_now_monotonic(sd_event *e, uint64_t *usec) {
 _public_ int sd_event_default(sd_event **ret) {
 
         static thread_local sd_event *default_event = NULL;
-        sd_event *e;
+        sd_event *e = NULL;
         int r;
 
         if (!ret)
diff --git a/src/libsystemd/sd-event/test-event.c b/src/libsystemd/sd-event/test-event.c
index 28ef6a3..c10aa8c 100644
--- a/src/libsystemd/sd-event/test-event.c
+++ b/src/libsystemd/sd-event/test-event.c
@@ -76,7 +76,7 @@ static int child_handler(sd_event_source *s, const siginfo_t *si, void *userdata
 }
 
 static int signal_handler(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) {
-        sd_event_source *p;
+        sd_event_source *p = NULL;
         sigset_t ss;
         pid_t pid;
 
@@ -106,7 +106,7 @@ static int signal_handler(sd_event_source *s, const struct signalfd_siginfo *si,
 }
 
 static int defer_handler(sd_event_source *s, void *userdata) {
-        sd_event_source *p;
+        sd_event_source *p = NULL;
         sigset_t ss;
 
         assert(s);
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index d7c074b..dc1d81c 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -480,7 +480,7 @@ static int session_start_scope(Session *s) {
         if (!s->scope) {
                 _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
                 _cleanup_free_ char *description = NULL;
-                char *scope, *job;
+                char *scope, *job = NULL;
 
                 description = strjoin("Session ", s->id, " of user ", s->user->name, NULL);
                 if (!description)
@@ -567,7 +567,7 @@ int session_start(Session *s) {
 
 static int session_stop_scope(Session *s, bool force) {
         _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
-        char *job;
+        char *job = NULL;
         int r;
 
         assert(s);
diff --git a/src/login/test-login.c b/src/login/test-login.c
index ce88af8..d78cea4 100644
--- a/src/login/test-login.c
+++ b/src/login/test-login.c
@@ -39,7 +39,7 @@ static void test_login(void) {
         uid_t *uids;
         unsigned n;
         struct pollfd pollfd;
-        sd_login_monitor *m;
+        sd_login_monitor *m = NULL;
 
         assert_se(sd_pid_get_session(0, &session) == 0);
         printf("session = %s\n", session);
diff --git a/src/machine/machine.c b/src/machine/machine.c
index e45c443..4596a80 100644
--- a/src/machine/machine.c
+++ b/src/machine/machine.c
@@ -252,7 +252,7 @@ static int machine_start_scope(Machine *m, sd_bus_message *properties, sd_bus_er
 
         if (!m->unit) {
                 _cleanup_free_ char *escaped = NULL;
-                char *scope, *description, *job;
+                char *scope, *description, *job = NULL;
 
                 escaped = unit_name_escape(m->name);
                 if (!escaped)
@@ -322,7 +322,7 @@ int machine_start(Machine *m, sd_bus_message *properties, sd_bus_error *error) {
 
 static int machine_stop_scope(Machine *m) {
         _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
-        char *job;
+        char *job = NULL;
         int r;
 
         assert(m);
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 37bc5ab..e574b2c 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -105,7 +105,7 @@ int link_get(Manager *m, int ifindex, Link **ret) {
 }
 
 int link_add(Manager *m, struct udev_device *device, Link **ret) {
-        Link *link;
+        Link *link = NULL;
         Network *network;
         int r;
 
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 350dc93..62c2e2e 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -743,7 +743,7 @@ static int setup_resolv_conf(const char *dest) {
 
 static int setup_boot_id(const char *dest) {
         _cleanup_free_ char *from = NULL, *to = NULL;
-        sd_id128_t rnd;
+        sd_id128_t rnd = {};
         char as_uuid[37];
         int r;
 
diff --git a/src/shared/acpi-fpdt.c b/src/shared/acpi-fpdt.c
index 7bae47f..390c323 100644
--- a/src/shared/acpi-fpdt.c
+++ b/src/shared/acpi-fpdt.c
@@ -83,7 +83,7 @@ struct acpi_fpdt_boot {
 int acpi_get_boot_usec(usec_t *loader_start, usec_t *loader_exit) {
         _cleanup_free_ char *buf = NULL;
         struct acpi_table_header *tbl;
-        size_t l;
+        size_t l = 0;
         struct acpi_fpdt_header *rec;
         int r;
         uint64_t ptr = 0;
diff --git a/src/shared/boot-timestamps.c b/src/shared/boot-timestamps.c
index d656685..54e0537 100644
--- a/src/shared/boot-timestamps.c
+++ b/src/shared/boot-timestamps.c
@@ -26,7 +26,7 @@
 #include "efivars.h"
 
 int boot_timestamps(const dual_timestamp *n, dual_timestamp *firmware, dual_timestamp *loader) {
-        usec_t x, y, a;
+        usec_t x = 0, y = 0, a;
         int r;
         dual_timestamp _n;
 
diff --git a/src/shared/efivars.c b/src/shared/efivars.c
index 000dae9..5ee8f1e 100644
--- a/src/shared/efivars.c
+++ b/src/shared/efivars.c
@@ -130,7 +130,7 @@ int efi_get_variable(
 
 int efi_get_variable_string(sd_id128_t vendor, const char *name, char **p) {
         _cleanup_free_ void *s = NULL;
-        size_t ss;
+        size_t ss = 0;
         int r;
         char *x;
 
@@ -393,7 +393,7 @@ fail:
 static int read_usec(sd_id128_t vendor, const char *name, usec_t *u) {
         _cleanup_free_ char *j = NULL;
         int r;
-        uint64_t x;
+        uint64_t x = 0;
 
         assert(name);
         assert(u);
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index b9b6643..cf1cd40 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -220,8 +220,8 @@ static int hibernation_partition_size(size_t *size, size_t *used) {
 
 static bool enough_memory_for_hibernation(void) {
         _cleanup_free_ char *active = NULL;
-        unsigned long long act;
-        size_t size, used;
+        unsigned long long act = 0;
+        size_t size = 0, used = 0;
         int r;
 
         r = hibernation_partition_size(&size, &used);
diff --git a/src/shared/socket-util.c b/src/shared/socket-util.c
index 6d9c303..5ef2e22 100644
--- a/src/shared/socket-util.c
+++ b/src/shared/socket-util.c
@@ -585,7 +585,7 @@ int getpeername_pretty(int fd, char **ret) {
                 return -errno;
 
         if (sa.sa.sa_family == AF_UNIX) {
-                struct ucred ucred;
+                struct ucred ucred = {};
 
                 /* UNIX connection sockets are anonymous, so let's use
                  * PID/UID as pretty credentials instead */
diff --git a/src/shared/util.c b/src/shared/util.c
index 55246f5..35e4338 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5903,7 +5903,7 @@ int proc_cmdline(char **ret) {
         int r;
 
         if (detect_container(NULL) > 0) {
-                char *buf, *p;
+                char *buf = NULL, *p;
                 size_t sz = 0;
 
                 r = read_full_file("/proc/1/cmdline", &buf, &sz);
diff --git a/src/test/test-cgroup-mask.c b/src/test/test-cgroup-mask.c
index 3414ed4..4d60859 100644
--- a/src/test/test-cgroup-mask.c
+++ b/src/test/test-cgroup-mask.c
@@ -32,7 +32,7 @@
 #include "test-helper.h"
 
 static int test_cgroup_mask(void) {
-        Manager *m;
+        Manager *m = NULL;
         Unit *son, *daughter, *parent, *root, *grandchild, *parent_deep;
         FILE *serial = NULL;
         FDSet *fdset = NULL;
diff --git a/src/test/test-sched-prio.c b/src/test/test-sched-prio.c
index a4cc3d4..e984ee4 100644
--- a/src/test/test-sched-prio.c
+++ b/src/test/test-sched-prio.c
@@ -25,7 +25,7 @@
 #include "macro.h"
 
 int main(int argc, char *argv[]) {
-        Manager *m;
+        Manager *m = NULL;
         Unit *idle_ok, *idle_bad, *rr_ok, *rr_bad, *rr_sched;
         Service *ser;
         FILE *serial = NULL;
diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c
index c10ec60..fff3e16 100644
--- a/src/test/test-unit-name.c
+++ b/src/test/test-unit-name.c
@@ -110,7 +110,7 @@ static void test_replacements(void) {
 }
 
 static int test_unit_printf(void) {
-        Manager *m;
+        Manager *m = NULL;
         Unit *u, *u2;
         int r;
 
diff --git a/src/test/test-util.c b/src/test/test-util.c
index cbd60d6..1ac4a1e 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -567,11 +567,11 @@ static void test_in_set(void) {
 
 static void test_writing_tmpfile(void) {
         char name[] = "/tmp/test-systemd_writing_tmpfile.XXXXXX";
-        _cleanup_free_ char *contents;
+        _cleanup_free_ char *contents = NULL;
         size_t size;
         int fd, r;
-
         struct iovec iov[3];
+
         IOVEC_SET_STRING(iov[0], "abc\n");
         IOVEC_SET_STRING(iov[1], ALPHANUMERICAL "\n");
         IOVEC_SET_STRING(iov[2], "");
diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c
index 08177c6..7a90e65 100644
--- a/src/tty-ask-password-agent/tty-ask-password-agent.c
+++ b/src/tty-ask-password-agent/tty-ask-password-agent.c
@@ -361,7 +361,7 @@ static int parse_password(const char *filename, char **wall) {
 
                 } else {
                         int tty_fd = -1;
-                        char *password;
+                        char *password = NULL;
 
                         if (arg_console)
                                 if ((tty_fd = acquire_terminal("/dev/console", false, false, false, (usec_t) -1)) < 0) {
diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c
index 2633423..1e91ec2 100644
--- a/src/udev/udev-ctrl.c
+++ b/src/udev/udev-ctrl.c
@@ -180,7 +180,7 @@ int udev_ctrl_get_fd(struct udev_ctrl *uctrl)
 struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl)
 {
         struct udev_ctrl_connection *conn;
-        struct ucred ucred;
+        struct ucred ucred = {};
         const int on = 1;
         int r;
 

commit ca721e36083e70709ce21376c0b89bc797e53f91
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 19 17:43:40 2014 +0100

    NEWS: Mention the new Personality= switch in unit files

diff --git a/NEWS b/NEWS
index c240d11..1d2ff43 100644
--- a/NEWS
+++ b/NEWS
@@ -381,7 +381,9 @@ CHANGES WITH 209:
 
         * systemd-nspawn gained a new --personality= switch for
           setting the kernel personality for the container. This is
-          useful when running a 32bit container on a 64bit host.
+          useful when running a 32bit container on a 64bit host. A
+          similar option Personality= is now also available in service
+          units.
 
         * logind will now also track a "Desktop" identifier for each
           session which encodes the desktop environment of it. This is



More information about the systemd-commits mailing list