chiark / gitweb /
Standarize on one spelling of symlink error message
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 23 Apr 2013 00:51:29 +0000 (20:51 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 24 Apr 2013 04:25:04 +0000 (00:25 -0400)
It's polite to print the name of the link that wasn't created,
and it makes little sense to print the target.

src/core/mount-setup.c
src/cryptsetup/cryptsetup-generator.c
src/efi-boot-generator/efi-boot-generator.c
src/getty-generator/getty-generator.c
src/rc-local-generator/rc-local-generator.c
src/system-update-generator/system-update-generator.c
src/udev/udev-watch.c

index a0fd7a0..89adb0b 100644 (file)
@@ -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;
index b31329d..228039d 100644 (file)
@@ -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;
         }
 
index 88fa220..4367c53 100644 (file)
@@ -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;
         }
 
index e811830..4b7a60a 100644 (file)
@@ -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;
                 }
         }
index 448980b..9265501 100644 (file)
@@ -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;
                 }
         }
index 6660192..13b8a0c 100644 (file)
@@ -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;
 }
 
index 311f5bd..9b694c6 100644 (file)
@@ -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);
 }