diff options
-rw-r--r-- | src/core/mount-setup.c | 6 | ||||
-rw-r--r-- | src/cryptsetup/cryptsetup-generator.c | 6 | ||||
-rw-r--r-- | src/efi-boot-generator/efi-boot-generator.c | 2 | ||||
-rw-r--r-- | src/getty-generator/getty-generator.c | 2 | ||||
-rw-r--r-- | src/rc-local-generator/rc-local-generator.c | 2 | ||||
-rw-r--r-- | src/system-update-generator/system-update-generator.c | 7 | ||||
-rw-r--r-- | src/udev/udev-watch.c | 2 |
7 files changed, 11 insertions, 16 deletions
diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c index a0fd7a078f..89adb0b4a3 100644 --- a/src/core/mount-setup.c +++ b/src/core/mount-setup.c @@ -334,7 +334,7 @@ int mount_cgroup_controllers(char ***join_controllers) { char **i; for (i = *k; *i; i++) { - char *t; + _cleanup_free_ char *t; t = strappend("/sys/fs/cgroup/", *i); if (!t) { @@ -344,10 +344,8 @@ int mount_cgroup_controllers(char ***join_controllers) { } r = symlink(options, t); - free(t); - if (r < 0 && errno != EEXIST) { - log_error("Failed to create symlink: %m"); + log_error("Failed to create symlink %s: %m", t); r = -errno; free(options); goto finish; diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c index b31329dc09..228039d91f 100644 --- a/src/cryptsetup/cryptsetup-generator.c +++ b/src/cryptsetup/cryptsetup-generator.c @@ -179,7 +179,7 @@ static int create_disk( mkdir_parents_label(to, 0755); if (symlink(from, to) < 0) { - log_error("Failed to create symlink '%s' to '%s': %m", from, to); + log_error("Failed to create symlink %s: %m", to); return -errno; } @@ -193,7 +193,7 @@ static int create_disk( mkdir_parents_label(to, 0755); if (symlink(from, to) < 0) { - log_error("Failed to create symlink '%s' to '%s': %m", from, to); + log_error("Failed to create symlink %s: %m", to); return -errno; } } @@ -209,7 +209,7 @@ static int create_disk( mkdir_parents_label(to, 0755); if (symlink(from, to) < 0) { - log_error("Failed to create symlink '%s' to '%s': %m", from, to); + log_error("Failed to create symlink %s: %m", to); return -errno; } diff --git a/src/efi-boot-generator/efi-boot-generator.c b/src/efi-boot-generator/efi-boot-generator.c index 88fa220d2f..4367c536b0 100644 --- a/src/efi-boot-generator/efi-boot-generator.c +++ b/src/efi-boot-generator/efi-boot-generator.c @@ -115,7 +115,7 @@ int main(int argc, char *argv[]) { mkdir_parents(name, 0755); if (symlink("../boot.automount", name) < 0) { - log_error("Failed to create symlink: %m"); + log_error("Failed to create symlink %s: %m", name); return EXIT_FAILURE; } diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c index e811830a6b..4b7a60a4ec 100644 --- a/src/getty-generator/getty-generator.c +++ b/src/getty-generator/getty-generator.c @@ -55,7 +55,7 @@ static int add_symlink(const char *fservice, const char *tservice) { /* In case console=hvc0 is passed this will very likely result in EEXIST */ r = 0; else { - log_error("Failed to create symlink from %s to %s: %m", from, to); + log_error("Failed to create symlink %s: %m", to); r = -errno; } } diff --git a/src/rc-local-generator/rc-local-generator.c b/src/rc-local-generator/rc-local-generator.c index 448980ba2d..9265501250 100644 --- a/src/rc-local-generator/rc-local-generator.c +++ b/src/rc-local-generator/rc-local-generator.c @@ -59,7 +59,7 @@ static int add_symlink(const char *service, const char *where) { if (errno == EEXIST) r = 0; else { - log_error("Failed to create symlink from %s to %s: %m", from, to); + log_error("Failed to create symlink %s: %m", to); r = -errno; } } diff --git a/src/system-update-generator/system-update-generator.c b/src/system-update-generator/system-update-generator.c index 6660192f5e..13b8a0c426 100644 --- a/src/system-update-generator/system-update-generator.c +++ b/src/system-update-generator/system-update-generator.c @@ -36,7 +36,7 @@ static const char *arg_dest = "/tmp"; static int generate_symlink(void) { struct stat st; - char *p; + char _cleanup_free_ *p = NULL; if (lstat("/system-update", &st) < 0) { if (errno == ENOENT) @@ -51,13 +51,10 @@ static int generate_symlink(void) { return log_oom(); if (symlink(SYSTEM_DATA_UNIT_PATH "/system-update.target", p) < 0) { - free(p); - log_error("Failed to create symlink: %m"); + log_error("Failed to create symlink %s: %m", p); return -errno; } - free(p); - return 0; } diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c index 311f5bdf23..9b694c6666 100644 --- a/src/udev/udev-watch.c +++ b/src/udev/udev-watch.c @@ -116,7 +116,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev) unlink(filename); r = symlink(udev_device_get_id_filename(dev), filename); if (r < 0) - log_error("Failed to create symlink: %m"); + log_error("Failed to create symlink %s: %m", filename); udev_device_set_watch_handle(dev, wd); } |