chiark / gitweb /
Standarize on one spelling of symlink error message
[elogind.git] / src / system-update-generator / system-update-generator.c
index abda5a0..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)
@@ -47,19 +47,14 @@ static int generate_symlink(void) {
         }
 
         p = strappend(arg_dest, "/default.target");
-        if (!p) {
-                log_error("Out of memory.");
-                return -ENOMEM;
-        }
+        if (!p)
+                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;
 }