summaryrefslogtreecommitdiff
path: root/src/boot/bootctl.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-06-25 00:24:23 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-06-25 01:31:26 +0900
commit270384b2d494bd1f53242c923f875ccfdf6e214d (patch)
tree66b619dc3c5e218b9ac87b5034d807a78fda5cb7 /src/boot/bootctl.c
parent2d9b74ba87a3fef313f362460d5d9a4283548ff6 (diff)
downloadsystemd-270384b2d494bd1f53242c923f875ccfdf6e214d.tar.gz
tree-wide: replace strjoina() with prefix_roota()
Diffstat (limited to 'src/boot/bootctl.c')
-rw-r--r--src/boot/bootctl.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c
index e7ba8b4ab9..246b1319c4 100644
--- a/src/boot/bootctl.c
+++ b/src/boot/bootctl.c
@@ -165,13 +165,13 @@ finish:
static int enumerate_binaries(const char *esp_path, const char *path, const char *prefix) {
_cleanup_closedir_ DIR *d = NULL;
struct dirent *de;
+ const char *p;
int c = 0, r;
- char *p;
assert(esp_path);
assert(path);
- p = strjoina(esp_path, "/", path);
+ p = prefix_roota(esp_path, path);
d = opendir(p);
if (!d) {
if (errno == ENOENT)
@@ -754,7 +754,7 @@ static int install_variables(const char *esp_path,
uint32_t part, uint64_t pstart, uint64_t psize,
sd_id128_t uuid, const char *path,
bool first) {
- char *p;
+ const char *p;
uint16_t slot;
int r;
@@ -763,7 +763,7 @@ static int install_variables(const char *esp_path,
return 0;
}
- p = strjoina(esp_path, path);
+ p = prefix_roota(esp_path, path);
if (access(p, F_OK) < 0) {
if (errno == ENOENT)
return 0;
@@ -792,12 +792,12 @@ static int install_variables(const char *esp_path,
}
static int remove_boot_efi(const char *esp_path) {
- char *p;
_cleanup_closedir_ DIR *d = NULL;
struct dirent *de;
+ const char *p;
int r, c = 0;
- p = strjoina(esp_path, "/EFI/BOOT");
+ p = prefix_roota(esp_path, "/EFI/BOOT");
d = opendir(p);
if (!d) {
if (errno == ENOENT)
@@ -838,9 +838,9 @@ static int remove_boot_efi(const char *esp_path) {
}
static int rmdir_one(const char *prefix, const char *suffix) {
- char *p;
+ const char *p;
- p = strjoina(prefix, "/", suffix);
+ p = prefix_roota(prefix, suffix);
if (rmdir(p) < 0) {
bool ignore = IN_SET(errno, ENOENT, ENOTEMPTY);
@@ -870,10 +870,10 @@ static int remove_esp_subdirs(const char *esp_path) {
}
static int remove_binaries(const char *esp_path) {
- char *p;
+ const char *p;
int r, q;
- p = strjoina(esp_path, "/EFI/systemd");
+ p = prefix_roota(esp_path, "/EFI/systemd");
r = rm_rf(p, REMOVE_ROOT|REMOVE_PHYSICAL);
q = remove_boot_efi(esp_path);
@@ -888,7 +888,7 @@ static int remove_loader_config(const char *esp_path) {
assert(esp_path);
- p = strjoina(esp_path, "/loader/loader.conf");
+ p = prefix_roota(esp_path, "/loader/loader.conf");
if (unlink(p) < 0) {
log_full_errno(errno == ENOENT ? LOG_DEBUG : LOG_ERR, errno, "Failed to unlink file \"%s\": %m", p);
if (errno != ENOENT)
@@ -933,7 +933,7 @@ static int install_loader_config(const char *esp_path, sd_id128_t machine_id) {
const char *p;
int r, fd;
- p = strjoina(esp_path, "/loader/loader.conf");
+ p = prefix_roota(esp_path, "/loader/loader.conf");
if (access(p, F_OK) >= 0) /* Silently skip creation if the file already exists (early check) */
return 0;