summaryrefslogtreecommitdiff
path: root/src/shared/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-30 00:47:41 +0200
committerLennart Poettering <lennart@poettering.net>2015-04-30 00:49:41 +0200
commit8b0849e9710d721c5d0b775aaf0fd662eefa1449 (patch)
treec185b5676d440e4ca30d0a1226fdbf49683a009a /src/shared/util.c
parent5cc0748e19490c4275aa66796679e3e67b649795 (diff)
core: rework cgroup path parse logic
Various cleanups, be stricter when parsing unit paths. Most importantly: return the root slice "-.slice" when asked for slice of paths that contain no slice component.
Diffstat (limited to 'src/shared/util.c')
-rw-r--r--src/shared/util.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 6a883d79d1..2c7254eeda 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -350,7 +350,6 @@ int parse_uid(const char *s, uid_t* ret_uid) {
int r;
assert(s);
- assert(ret_uid);
r = safe_atolu(s, &ul);
if (r < 0)
@@ -369,7 +368,9 @@ int parse_uid(const char *s, uid_t* ret_uid) {
if (uid == (uid_t) 0xFFFF)
return -ENXIO;
- *ret_uid = uid;
+ if (ret_uid)
+ *ret_uid = uid;
+
return 0;
}