daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
923a60
From f441ddae6363a10b1e8d8764bc906866f6ee6f48 Mon Sep 17 00:00:00 2001
923a60
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
923a60
Date: Thu, 29 Sep 2016 16:07:41 +0200
923a60
Subject: [PATCH] pid1: more informative error message for ignored
923a60
 notifications
923a60
923a60
It's probably easier to diagnose a bad notification message if the
923a60
contents are printed. But still, do anything only if debugging is on.
923a60
923a60
 Conflicts:
923a60
	src/core/manager.c
923a60
923a60
Cherry-picked from: a86b76753d7868c2d05f046f601bc7dc89fc2203
923a60
Resolves: #1380259
923a60
---
923a60
 src/core/manager.c | 8 ++++++++
923a60
 1 file changed, 8 insertions(+)
923a60
923a60
diff --git a/src/core/manager.c b/src/core/manager.c
923a60
index 0376c4d4b4..27f032b9d9 100644
923a60
--- a/src/core/manager.c
923a60
+++ b/src/core/manager.c
923a60
@@ -1631,6 +1631,14 @@ static void manager_invoke_notify_message(Manager *m, Unit *u, pid_t pid, const
923a60
 
923a60
         if (UNIT_VTABLE(u)->notify_message)
923a60
                 UNIT_VTABLE(u)->notify_message(u, pid, tags, fds);
923a60
+        else if (_unlikely_(log_get_max_level() >= LOG_DEBUG)) {
923a60
+                _cleanup_free_ char *x = NULL, *y = NULL;
923a60
+
923a60
+                x = cescape(buf);
923a60
+                if (x)
923a60
+                        y = ellipsize(x, 20, 90);
923a60
+                log_unit_debug(u, "Got notification message \"%s\", ignoring.", strnull(y));
923a60
+        }
923a60
 }
923a60
 
923a60
 static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t revents, void *userdata) {