]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-daemon: escape notification msg using shell_escape() 40987/head
authorMike Yuan <me@yhndnzj.com>
Sat, 7 Mar 2026 04:37:30 +0000 (05:37 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Sat, 13 Jun 2026 15:11:11 +0000 (17:11 +0200)
Follow-up for f9e0a62392fa62364bb7ac31a1cd4a8cc521cced

xescape() would unconditionally emit hex escapes, rendering
\n unreadable.

src/libsystemd/sd-daemon/sd-daemon.c

index da5242c3b799d93e29616d1caa56887dd5dae8eb..50bdcb1a238165a15e0533b6a0e7f3cfa63436b1 100644 (file)
@@ -637,8 +637,8 @@ static int pid_notify_with_fds_internal(
         }
 
         if (DEBUG_LOGGING) {
-                _cleanup_free_ char *escaped = xescape_full(state, "\"", /* console_width = */ SIZE_MAX, XESCAPE_8_BIT);
-                log_debug("Notify message sent to '%s': \"%s\"", e, escaped ?: state);
+                _cleanup_free_ char *escaped = shell_escape(state, "\"");
+                log_debug("Notify message sent to '%s': \"%s\"", e, strnull(escaped));
         }
 
         return 1;