From 43f7e07c5b087996ea0c7a80dcf44976d81620be Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 2 May 2020 11:00:33 +0100 Subject: [PATCH] server: Fix binary in --dump-config output. As written this will only work on Linux. On platforms which lack /proc/self/exe the binary name will be missing in the output. Fixes: commit a47857b47b88adbf5054772be4d6746ec08ca16f --- server/main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/main.c b/server/main.c index eb04a174..9dd9d400 100644 --- a/server/main.c +++ b/server/main.c @@ -129,11 +129,10 @@ display_version (void) } static void -dump_config (const char *argv0) +dump_config (void) { - CLEANUP_FREE char *binary; + CLEANUP_FREE char *binary = realpath ("/proc/self/exe", NULL); - binary = realpath (argv0, NULL); if (binary != NULL) printf ("%s=%s\n", "binary", binary); printf ("%s=%s\n", "bindir", bindir); @@ -216,7 +215,7 @@ main (int argc, char *argv[]) switch (c) { case DUMP_CONFIG_OPTION: - dump_config (argv[0]); + dump_config (); exit (EXIT_SUCCESS); case DUMP_PLUGIN_OPTION: -- 2.25.0