bootctl: do not print slash more than once
When bootctl is called by an unprivileged user, then previously we got ``` Failed to read "/boot/EFI/systemd": Permission denied Failed to open '/boot//loader/loader.conf': Permission denied ``` Now, with this patch, we get ``` Failed to read "/boot/EFI/systemd": Permission denied Failed to open '/boot/loader/loader.conf': Permission denied ```
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
0af9937691
commit
91c60ff528
@@ -880,7 +880,7 @@ static int install_variables(
|
||||
if (r == -ENOENT)
|
||||
return 0;
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Cannot access \"%s/%s\": %m", esp_path, path);
|
||||
return log_error_errno(r, "Cannot access \"%s/%s\": %m", esp_path, skip_leading_slash(path));
|
||||
|
||||
r = find_slot(uuid, path, &slot);
|
||||
if (r < 0) {
|
||||
|
||||
@@ -215,7 +215,7 @@ static int enumerate_binaries(
|
||||
if (r == -ENOENT)
|
||||
return 0;
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to read \"%s/%s\": %m", esp_path, path);
|
||||
return log_error_errno(r, "Failed to read \"%s/%s\": %m", esp_path, skip_leading_slash(path));
|
||||
|
||||
FOREACH_DIRENT(de, d, break) {
|
||||
_cleanup_free_ char *v = NULL, *filename = NULL;
|
||||
@@ -855,7 +855,7 @@ static int cleanup_orphaned_files(
|
||||
if (dir_fd == -ENOENT)
|
||||
return 0;
|
||||
if (dir_fd < 0)
|
||||
return log_error_errno(dir_fd, "Failed to open '%s/%s': %m", root, arg_entry_token);
|
||||
return log_error_errno(dir_fd, "Failed to open '%s/%s': %m", root, skip_leading_slash(arg_entry_token));
|
||||
|
||||
p = path_join("/", arg_entry_token);
|
||||
if (!p)
|
||||
|
||||
Reference in New Issue
Block a user