From 3e085b6c59257ca57534afc5044256f2102f9c28 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 23 Sep 2011 02:39:54 +0200 Subject: [PATCH] llvm-analyze: change a few things to make llvm-analyze show fewer false positives --- src/logind.c | 7 +++++-- src/sysfs-show.c | 3 +++ src/systemctl.c | 2 -- src/umount.c | 7 +++++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/logind.c b/src/logind.c index 1aad48d2..4633a5ef 100644 --- a/src/logind.c +++ b/src/logind.c @@ -413,6 +413,7 @@ static int manager_enumerate_users_from_cgroup(Manager *m) { int r = 0; char *name; DIR *d; + int k; r = cg_enumerate_subgroups(SYSTEMD_CGROUP_CONTROLLER, m->cgroup_path, &d); if (r < 0) { @@ -423,9 +424,8 @@ static int manager_enumerate_users_from_cgroup(Manager *m) { return r; } - while ((r = cg_read_subgroup(d, &name)) > 0) { + while ((k = cg_read_subgroup(d, &name)) > 0) { User *user; - int k; k = manager_add_user_by_name(m, name, &user); if (k < 0) { @@ -446,6 +446,9 @@ static int manager_enumerate_users_from_cgroup(Manager *m) { free(name); } + if (r >= 0 && k < 0) + r = k; + closedir(d); return r; diff --git a/src/sysfs-show.c b/src/sysfs-show.c index ab866a47..b8b356d7 100644 --- a/src/sysfs-show.c +++ b/src/sysfs-show.c @@ -165,6 +165,9 @@ int show_sysfs(const char *seat, const char *prefix, unsigned n_columns) { else r = udev_enumerate_add_match_tag(e, "seat"); + if (r < 0) + goto finish; + r = udev_enumerate_scan_devices(e); if (r < 0) goto finish; diff --git a/src/systemctl.c b/src/systemctl.c index fdff2d12..2bf2b697 100644 --- a/src/systemctl.c +++ b/src/systemctl.c @@ -2154,8 +2154,6 @@ static void print_status_info(UnitStatusInfo *i) { printf(")%s\n", off); - on = off = NULL; - if (i->main_pid == p->pid && i->start_timestamp == p->start_timestamp && i->exit_timestamp == p->start_timestamp) diff --git a/src/umount.c b/src/umount.c index 67be42ea..4e036d82 100644 --- a/src/umount.c +++ b/src/umount.c @@ -565,10 +565,13 @@ int umount_all(bool *changed) { /* retry umount, until nothing can be umounted anymore */ do { umount_changed = false; - r = mount_points_list_umount(&mp_list_head, &umount_changed, false); + + mount_points_list_umount(&mp_list_head, &umount_changed, false); if (umount_changed) *changed = true; - } while(umount_changed); + + } while (umount_changed); + /* umount one more time with logging enabled */ r = mount_points_list_umount(&mp_list_head, &umount_changed, true); if (r <= 0) -- 2.39.5