From: Yu Watanabe Date: Mon, 5 Jun 2023 04:20:42 +0000 (+0900) Subject: chase: fix triggering assertion X-Git-Tag: v254-rc1~289 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=308b1895113385e6ad90746c65495c405873f980;p=thirdparty%2Fsystemd.git chase: fix triggering assertion --- diff --git a/src/basic/chase.c b/src/basic/chase.c index 983901f7141..600e2b9d33c 100644 --- a/src/basic/chase.c +++ b/src/basic/chase.c @@ -206,7 +206,7 @@ int chaseat(int dir_fd, const char *path, ChaseFlags flags, char **ret_path, int /* If we receive an absolute path together with AT_FDCWD, we need to return an absolute path, because * a relative path would be interpreted relative to the current working directory. Also, let's make * the result absolute when the file descriptor of the root directory is specified. */ - bool need_absolute = (dir_fd == AT_FDCWD && path_is_absolute(path)) || dir_fd_is_root(dir_fd) > 0; + bool need_absolute = (dir_fd == AT_FDCWD && path_is_absolute(path)) || (dir_fd >= 0 && dir_fd_is_root(dir_fd) > 0); if (need_absolute) { done = strdup("/"); if (!done)