diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2013-07-07 11:44:52 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2013-07-07 11:44:52 -0400 |
commit | c9096d049007b7197efca087aa620f370bf86c15 (patch) | |
tree | 64b7d6f7d3185f54c2054fafb467b0ef46c900a4 | |
parent | 68db594ba673d5afa40e2646246c5bcbf74d948d (diff) |
Add sanity checks to paths in cgroup-util.c
This is part of upstream commit
9444b1f20e311f073864d81e913bd4f32fe95cfd
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
-rw-r--r-- | src/libudev/cgroup-util.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libudev/cgroup-util.c b/src/libudev/cgroup-util.c index a276bf1061..71bd529ad2 100644 --- a/src/libudev/cgroup-util.c +++ b/src/libudev/cgroup-util.c @@ -169,19 +169,19 @@ static const char *normalize_controller(const char *controller) { static int join_path(const char *controller, const char *path, const char *suffix, char **fs) { char *t = NULL; - if (controller) { - if (path && suffix) + if (!isempty(controller)) { + if (!isempty(path) && !isempty(suffix)) t = strjoin("/sys/fs/cgroup/", controller, "/", path, "/", suffix, NULL); - else if (path) + else if (!isempty(path)) t = strjoin("/sys/fs/cgroup/", controller, "/", path, NULL); - else if (suffix) + else if (!isempty(suffix)) t = strjoin("/sys/fs/cgroup/", controller, "/", suffix, NULL); else t = strappend("/sys/fs/cgroup/", controller); } else { - if (path && suffix) + if (!isempty(path) && !isempty(suffix)) t = strjoin(path, "/", suffix, NULL); - else if (path) + else if (!isempty(path)) t = strdup(path); else return -EINVAL; |