]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
unit-file: avoid (null) in debugging logs
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 23 Jul 2022 03:48:35 +0000 (12:48 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 24 Jul 2022 11:51:27 +0000 (20:51 +0900)
The variable `inst` was set to NULL by TAKE_PTR().

This fixes the following log message:
```
systemd[1]: Unit getty@tty2.service has alias (null).
```

src/basic/unit-file.c

index 43d35a231818e6fd2d64ebf20f6c9d0f6efc8637..c81c69db305b5840b526fa1d73bec2ab63cb83fa 100644 (file)
@@ -697,12 +697,9 @@ static int add_names(
                                 continue;
                         }
 
-                        r = set_consume(*names, TAKE_PTR(inst));
-                        if (r > 0)
-                                log_debug("Unit %s has alias %s.", unit_name, inst);
+                        r = add_name(unit_name, names, inst);
                 } else
                         r = add_name(unit_name, names, *alias);
-
                 if (r < 0)
                         return r;
         }