summaryrefslogtreecommitdiff
path: root/src/shared/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-30 00:47:41 +0200
committerAnthony G. Basile <blueness@gentoo.org>2015-05-04 14:19:24 -0400
commit8387ce96ffd04ce048368480a269cbf5166394db (patch)
tree74a6e435ad7266bada2fe3a57228b78a9b10a5e5 /src/shared/util.c
parent1fdf69d5ef4e76633bf325aa8c709b8904ff6a7a (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. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
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 befe019588..c30b4eaf57 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -258,7 +258,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)
@@ -277,7 +276,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;
}