]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
run-generator: use generator_add_symlink()
authorAntonio Alvarez Feijoo <antonio.feijoo@suse.com>
Tue, 2 Dec 2025 07:20:13 +0000 (08:20 +0100)
committerMike Yuan <me@yhndnzj.com>
Wed, 3 Dec 2025 14:52:55 +0000 (15:52 +0100)
src/run-generator/run-generator.c

index c2107896193aba9f56f28df98d12d6e45fbb5252..edbc1adbed8c242cebec805d5e444e0fcab53af3 100644 (file)
@@ -6,7 +6,6 @@
 #include "fd-util.h"
 #include "fileio.h"
 #include "generator.h"
-#include "glyph-util.h"
 #include "log.h"
 #include "proc-cmdline.h"
 #include "special.h"
@@ -115,12 +114,11 @@ static int generate(void) {
                 return log_error_errno(r, "Failed to create unit file %s: %m", p);
 
         /* And now redirect default.target to our new target */
-        p = strjoina(arg_dest, "/" SPECIAL_DEFAULT_TARGET);
-        if (symlink("kernel-command-line.target", p) < 0)
-                return log_error_errno(errno, "Failed to link unit file kernel-command-line.target %s %s: %m",
-                                       glyph(GLYPH_ARROW_RIGHT), p);
-
-        return 0;
+        return generator_add_symlink(
+                        arg_dest,
+                        SPECIAL_DEFAULT_TARGET,
+                        /* dep_type= */ NULL,
+                        "kernel-command-line.target");
 }
 
 static int run(const char *dest, const char *dest_early, const char *dest_late) {