1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-02 13:47:27 +03:00

tree-wide: fd_get_path() already understands AT_FDCWD natively

This commit is contained in:
Lennart Poettering 2024-12-09 12:48:07 +01:00 committed by Mike Yuan
parent 92acb89735
commit e82677aa07
2 changed files with 3 additions and 10 deletions

View File

@ -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")) ||

View File

@ -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;