summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2012-05-09 21:42:56 +0200
committerMichal Schmidt <mschmidt@redhat.com>2012-05-09 21:42:56 +0200
commit1ebf0cb73dacaf12c095580d8223a83cc96e441d (patch)
tree1cfae87554885c35d09a0b40287ea30af59bad29
parentb809bd0940b3c12d49cfc79d2a2c1a449b3dcf50 (diff)
dbus-manager: fix tainted string
The pointer to the end of the string was not advanced after adding the "cgroups-missing" taint. If "local-hwclock" was detected too, it would overwrite the previous string. With 'e' always pointing to the end of the string, removing the last delimiter is easier.
-rw-r--r--src/core/dbus-manager.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 2e6bc3dfec..6ad198436a 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -310,13 +310,14 @@ static int bus_manager_append_tainted(DBusMessageIter *i, const char *property,
free(p);
if (access("/proc/cgroups", F_OK) < 0)
- stpcpy(e, "cgroups-missing:");
+ e = stpcpy(e, "cgroups-missing:");
if (hwclock_is_localtime() > 0)
- stpcpy(e, "local-hwclock:");
+ e = stpcpy(e, "local-hwclock:");
- if (endswith(buf, ":"))
- buf[strlen(buf)-1] = 0;
+ /* remove the last ':' */
+ if (e != buf)
+ e[-1] = 0;
t = buf;