diff options
author | Mike Yuan <me@yhndnzj.com> | 2024-04-03 16:54:48 +0200 |
---|---|---|
committer | Mike Yuan <me@yhndnzj.com> | 2024-04-03 17:51:11 +0200 |
commit | a2098d8bf73fc043b919db02b49b73e94a63ad5c (patch) | |
tree | 7c53d809e4006d53053e45d855f112161eb4fe0b /src/core | |
parent | string-util: add missing assertion in cellescape (diff) | |
download | systemd-a2098d8bf73fc043b919db02b49b73e94a63ad5c.tar.xz systemd-a2098d8bf73fc043b919db02b49b73e94a63ad5c.zip |
core/manager: use cellescape and don't be too aggressive
Addresses https://github.com/systemd/systemd/pull/32068#issuecomment-2034799862
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/manager.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/core/manager.c b/src/core/manager.c index b8b5f085e6..0103c582b5 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -2586,22 +2586,17 @@ static void manager_invoke_notify_message( UNIT_VTABLE(u)->notify_message(u, ucred, tags, fds); else if (DEBUG_LOGGING) { - _cleanup_free_ char *buf = NULL, *x = NULL, *y = NULL; + _cleanup_free_ char *joined = strv_join(tags, ", "); + char buf[CELLESCAPE_DEFAULT_LENGTH]; - buf = strv_join(tags, ", "); - if (buf) - x = ellipsize(buf, 20, 90); - if (x) - y = cescape(x); - - log_unit_debug(u, "Got notification message \"%s\", ignoring.", strnull(y)); + log_unit_debug(u, "Got notification message from unexpected unit type, ignoring: %s", + joined ? cellescape(buf, sizeof(buf), joined) : "(null)"); } } static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t revents, void *userdata) { - - _cleanup_fdset_free_ FDSet *fds = NULL; Manager *m = ASSERT_PTR(userdata); + _cleanup_fdset_free_ FDSet *fds = NULL; char buf[NOTIFY_BUFFER_MAX+1]; struct iovec iovec = { .iov_base = buf, |