1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

unit-file: avoid (null) in debugging logs

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).
```

(cherry picked from commit 7c35b78a0b)
(cherry picked from commit 9ac0ad80fe)
This commit is contained in:
Yu Watanabe 2022-07-23 12:48:35 +09:00 committed by Zbigniew Jędrzejewski-Szmek
parent aa97e014fa
commit 0e7214c8b5

View File

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