From: Lennart Poettering Date: Mon, 9 Dec 2024 11:48:07 +0000 (+0100) Subject: tree-wide: fd_get_path() already understands AT_FDCWD natively X-Git-Tag: v258-rc1~1933 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e82677aa07b5884587d52f54e2d27fe10ca49433;p=thirdparty%2Fsystemd.git tree-wide: fd_get_path() already understands AT_FDCWD natively --- diff --git a/src/shared/discover-image.c b/src/shared/discover-image.c index 10b2405cc37..82e0ad4c027 100644 --- a/src/shared/discover-image.c +++ b/src/shared/discover-image.c @@ -351,12 +351,8 @@ static int image_make( st = &stbuf; } - if (!path) { - if (dfd == AT_FDCWD) - (void) safe_getcwd(&parent); - else - (void) fd_get_path(dfd, &parent); - } + if (!path) + (void) fd_get_path(dfd, &parent); read_only = (path && path_startswith(path, "/usr")) || diff --git a/src/shared/selinux-util.c b/src/shared/selinux-util.c index 4d3b127d8e9..ff49e219a0b 100644 --- a/src/shared/selinux-util.c +++ b/src/shared/selinux-util.c @@ -584,10 +584,7 @@ int mac_selinux_create_file_prepare_at( return 0; if (isempty(path) || !path_is_absolute(path)) { - if (dir_fd == AT_FDCWD) - r = safe_getcwd(&abspath); - else - r = fd_get_path(dir_fd, &abspath); + r = fd_get_path(dir_fd, &abspath); if (r < 0) return r;