From: Lennart Poettering Date: Thu, 14 May 2020 07:18:58 +0000 (+0200) Subject: condition: check if path is absolute first X-Git-Tag: v246-rc1~343^2~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=841c0987f7c199f06c92e7cc77d61b45fc552389;p=thirdparty%2Fsystemd.git condition: check if path is absolute first We should do this check first since it is done on the string itself without any conditioning of system state otherwise. It is a weird to do this test only if /etc is read-only. --- diff --git a/src/shared/condition.c b/src/shared/condition.c index c83a4ba0eb8..e5de303a4b6 100644 --- a/src/shared/condition.c +++ b/src/shared/condition.c @@ -553,16 +553,15 @@ static int condition_test_needs_update(Condition *c, char **env) { assert(c->parameter); assert(c->type == CONDITION_NEEDS_UPDATE); + if (!path_is_absolute(c->parameter)) + return true; + /* If the file system is read-only we shouldn't suggest an update */ if (path_is_read_only_fs(c->parameter) > 0) return false; - /* Any other failure means we should allow the condition to be true, - * so that we rather invoke too many update tools than too - * few. */ - - if (!path_is_absolute(c->parameter)) - return true; + /* Any other failure means we should allow the condition to be true, so that we rather invoke too + * many update tools than too few. */ p = strjoina(c->parameter, "/.updated"); if (lstat(p, &other) < 0)