core/socket: fix reversed symlink direction in error message
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.
This commit is contained in:
committed by
Mike Yuan
parent
8a2b2828cc
commit
13167bfc2f
+11
-12
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user