From: Yu Watanabe Date: Mon, 24 Jun 2019 14:36:38 +0000 (+0900) Subject: path-util: fix an issue when the path argument of prefix_roota() is not absolute X-Git-Tag: v243-rc1~239^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=95bbf19e2f13466ce81664a82ce29960c0154ddb;p=thirdparty%2Fsystemd.git path-util: fix an issue when the path argument of prefix_roota() is not absolute When the first argument is '/' and the second argument is not absolute, the return value was not prefixed with '/'. This fixes the issue. --- diff --git a/src/basic/path-util.h b/src/basic/path-util.h index af4878b3255..4a1ed0a1a8b 100644 --- a/src/basic/path-util.h +++ b/src/basic/path-util.h @@ -117,7 +117,7 @@ int mkfs_exists(const char *fstype); _slash = strrchr((prefix), '/')) /* Similar to path_join(), but only works for two components, and only the first one may be NULL and returns - * an alloca() buffer, or possibly a const pointer into the path parameter */ + * an alloca() buffer, or possibly a const pointer into the path parameter. */ #define prefix_roota(root, path) \ ({ \ const char* _path = (path), *_root = (root), *_ret; \ @@ -125,7 +125,7 @@ int mkfs_exists(const char *fstype); size_t _l; \ while (_path[0] == '/' && _path[1] == '/') \ _path ++; \ - if (empty_or_root(_root)) \ + if (isempty(_root)) \ _ret = _path; \ else { \ _l = strlen(_root) + 1 + strlen(_path) + 1; \