From: Zbigniew Jędrzejewski-Szmek Date: Mon, 27 Jan 2014 06:23:16 +0000 (-0500) Subject: core: simplify check for path absoluteness X-Git-Tag: v209~330 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=70b64bd3561c2bbe6cad2e590d4e3e25426f75b5 core: simplify check for path absoluteness Just a microopt. --- diff --git a/src/core/unit.c b/src/core/unit.c index e3b620603..fc1465834 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -2997,17 +2997,15 @@ int unit_require_mounts_for(Unit *u, const char *path) { * units can easily determine which units to make themselves a * dependency of. */ + if (!path_is_absolute(path)) + return -EINVAL; + p = strdup(path); if (!p) return -ENOMEM; path_kill_slashes(p); - if (!path_is_absolute(p)) { - free(p); - return -EINVAL; - } - if (!path_is_safe(p)) { free(p); return -EPERM;