1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-22 22:03:43 +03:00

debug-generator: Use generator_add_symlink()

This commit is contained in:
Daan De Meyer 2023-08-04 08:25:53 +02:00 committed by Luca Boccassi
parent aff853f8ea
commit bd6c95c00b

View File

@ -112,7 +112,7 @@ static int generate_wants_symlinks(void) {
int r = 0; int r = 0;
STRV_FOREACH(u, arg_wants) { STRV_FOREACH(u, arg_wants) {
_cleanup_free_ char *p = NULL, *f = NULL; _cleanup_free_ char *f = NULL;
const char *target; const char *target;
/* This should match what do_queue_default_job() in core/main.c does. */ /* This should match what do_queue_default_job() in core/main.c does. */
@ -123,20 +123,13 @@ static int generate_wants_symlinks(void) {
else else
target = SPECIAL_DEFAULT_TARGET; target = SPECIAL_DEFAULT_TARGET;
p = strjoin(arg_dest, "/", target, ".wants/", *u);
if (!p)
return log_oom();
f = path_join(SYSTEM_DATA_UNIT_DIR, *u); f = path_join(SYSTEM_DATA_UNIT_DIR, *u);
if (!f) if (!f)
return log_oom(); return log_oom();
(void) mkdir_parents_label(p, 0755); r = generator_add_symlink(arg_dest, target, "wants", f);
if (r < 0)
if (symlink(f, p) < 0) return r;
r = log_error_errno(errno,
"Failed to create wants symlink %s: %m",
p);
} }
return r; return r;