]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/daemon-util: fix notify_on_cleanup()
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 15 Oct 2020 17:22:21 +0000 (19:22 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 19 Oct 2020 13:23:37 +0000 (15:23 +0200)
p itself is never null. Because of this, we would always
call sd_notify() in cleanup, even though the intention was to only
call it if notify_start() was executed.

src/shared/daemon-util.h

index 5e9eca1d9e73907cd4a786bcd6db96ddc6f13d79..04b8245310044643e7609f20c83d50cc6cc2517c 100644 (file)
@@ -17,6 +17,6 @@ static inline const char *notify_start(const char *start, const char *stop) {
 
 /* This is intended to be used with _cleanup_ attribute. */
 static inline void notify_on_cleanup(const char **p) {
-        if (p)
+        if (*p)
                 (void) sd_notify(false, *p);
 }