From 3621e136addd903dc58b60f23476ee07f30935fc Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Fri, 4 Aug 2023 08:25:53 +0200 Subject: [PATCH] debug-generator: Use generator_add_symlink() (cherry picked from commit bd6c95c00b7a25b4d360bac22d3a3bc54132c415) (cherry picked from commit 0d1198a79c721dd35a66588ad72d446ce4fa15f0) --- src/debug-generator/debug-generator.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/debug-generator/debug-generator.c b/src/debug-generator/debug-generator.c index 1fe2b56810..8a474c58cf 100644 --- a/src/debug-generator/debug-generator.c +++ b/src/debug-generator/debug-generator.c @@ -112,7 +112,7 @@ static int generate_wants_symlinks(void) { int r = 0; STRV_FOREACH(u, arg_wants) { - _cleanup_free_ char *p = NULL, *f = NULL; + _cleanup_free_ char *f = NULL; const char *target; /* This should match what do_queue_default_job() in core/main.c does. */ @@ -123,20 +123,13 @@ static int generate_wants_symlinks(void) { else target = SPECIAL_DEFAULT_TARGET; - p = strjoin(arg_dest, "/", target, ".wants/", *u); - if (!p) - return log_oom(); - f = path_join(SYSTEM_DATA_UNIT_DIR, *u); if (!f) return log_oom(); - (void) mkdir_parents_label(p, 0755); - - if (symlink(f, p) < 0) - r = log_error_errno(errno, - "Failed to create wants symlink %s: %m", - p); + r = generator_add_symlink(arg_dest, target, "wants", f); + if (r < 0) + return r; } return r;