Suppress successful putval responses to exec plugin
authorAntonio Russo <antonio.e.russo@gmail.com>
Tue, 16 Feb 2016 19:22:48 +0000 (11:22 -0800)
committerAntonio Russo <antonio.e.russo@gmail.com>
Tue, 16 Feb 2016 19:33:48 +0000 (11:33 -0800)
exec plugins are never supposed to receive responses
to putval commands. These responses are instead sent
to STDOUT, which is often attached to /dev/null.
Newer init systems, such as systemd, instead log
these responses.

This patch preserves the expected behavior by suppressing
the response if and only if the destination is STDOUT.

src/utils_cmd_putval.c

index 7b0258c..7b6a39d 100644 (file)
@@ -217,7 +217,8 @@ int handle_putval (FILE *fh, char *buffer)
        } /* while (*buffer != 0) */
        /* Done parsing the options. */
 
-       print_to_socket (fh, "0 Success: %i %s been dispatched.\n",
+    if (fh!=stdout)
+           print_to_socket (fh, "0 Success: %i %s been dispatched.\n",
                        values_submitted,
                        (values_submitted == 1) ? "value has" : "values have");