]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/socket: fix reversed symlink direction in error message
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Thu, 26 Feb 2026 08:25:48 +0000 (09:25 +0100)
committerMike Yuan <me@yhndnzj.com>
Thu, 26 Feb 2026 10:34:22 +0000 (11:34 +0100)
After the update to 260-rc1 in Fedora Rawhide, we get a lot of messages like
this:
  systemd[1]: systemd-resolved-monitor.socket:
  Failed to create symlink /run/systemd/resolve/io.systemd.Resolve.Monitor →
  /run/varlink/registry/io.systemd.Resolve.Monitor, ignoring: Permission denied

The actual issue will need to be fixed too, but let's fix the message first.
While at it, let's rename the variables to be meaningful.

src/core/socket.c

index 0ca9d80e0459810c99dea8cbe1dd4797c9736676..c18f28aad684340709ca9600e146b82d8761fc75 100644 (file)
@@ -1347,30 +1347,29 @@ static int mq_address_create(
 }
 
 static int socket_symlink(Socket *s) {
-        const char *p;
         int r;
 
         assert(s);
 
-        p = socket_find_symlink_target(s);
-        if (!p)
+        const char *target = socket_find_symlink_target(s);
+        if (!target)
                 return 0;
 
-        STRV_FOREACH(i, s->symlinks) {
-                (void) mkdir_parents_label(*i, s->directory_mode);
+        STRV_FOREACH(linkpath, s->symlinks) {
+                (void) mkdir_parents_label(*linkpath, s->directory_mode);
 
-                r = symlink_idempotent(p, *i, false);
+                r = symlink_idempotent(target, *linkpath, false);
                 if (r == -EEXIST && s->remove_on_stop) {
-                        /* If there's already something where we want to create the symlink, and the destructive
-                         * RemoveOnStop= mode is set, then we might as well try to remove what already exists and try
-                         * again. */
+                        /* If there's already something where we want to create the symlink, and the
+                         * destructive RemoveOnStop= mode is set, then we might as well try to remove what
+                         * already exists and try again. */
 
-                        if (unlink(*i) >= 0)
-                                r = symlink_idempotent(p, *i, false);
+                        if (unlink(*linkpath) >= 0)
+                                r = symlink_idempotent(target, *linkpath, false);
                 }
                 if (r < 0)
                         log_unit_warning_errno(UNIT(s), r, "Failed to create symlink %s %s %s, ignoring: %m",
-                                               p, glyph(GLYPH_ARROW_RIGHT), *i);
+                                               *linkpath, glyph(GLYPH_ARROW_RIGHT), target);
         }
 
         return 0;