From: Lennart Poettering Date: Tue, 26 Sep 2017 16:27:09 +0000 (+0200) Subject: socket: make sure we warn loudly about symlinks we can't create X-Git-Tag: v235~51^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=95f7fbbf887955bdbb790d61091487b48d51de9d;p=thirdparty%2Fsystemd.git socket: make sure we warn loudly about symlinks we can't create Note that this change does not make symlink creation failing fatal. I am not entirely sure about whether it should be, but I am leaning towards not making it fatal for two reasons: symlinks like this tend to be a compatibility feature, and hence unlikely to be essential for operation, in a way this breaks compatibility, and while doing that is not off the table, we should probably avoid it if we are not entirely sure it's a good thing. Note that this also changes plain symlink() to symlink_idempotent() so that existing symlinks with the right destination are nothing we log about. Fixes: #6920 --- diff --git a/src/core/socket.c b/src/core/socket.c index 3b84ffa2a79..d1d4007588d 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -38,6 +38,7 @@ #include "exit-status.h" #include "fd-util.h" #include "format-util.h" +#include "fs-util.h" #include "in-addr-util.h" #include "io-util.h" #include "label.h" @@ -1324,6 +1325,7 @@ static int mq_address_create( static int socket_symlink(Socket *s) { const char *p; char **i; + int r; assert(s); @@ -1331,8 +1333,11 @@ static int socket_symlink(Socket *s) { if (!p) return 0; - STRV_FOREACH(i, s->symlinks) - symlink_label(p, *i); + STRV_FOREACH(i, s->symlinks) { + r = symlink_idempotent(p, *i); + if (r < 0) + log_unit_warning_errno(UNIT(s), r, "Failed to create symlink %s → %s, ignoring: %m", p, *i); + } return 0; }