Upstream patch to fix the --dump-config output.

This commit is contained in:
Richard W.M. Jones 2020-05-02 11:07:42 +01:00
parent 4e02512ea3
commit 1c3e016844
2 changed files with 48 additions and 2 deletions

View File

@ -0,0 +1,43 @@
From 43f7e07c5b087996ea0c7a80dcf44976d81620be Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
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

View File

@ -38,7 +38,7 @@ ExclusiveArch: x86_64
Name: nbdkit
Version: 1.20.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: NBD server
License: BSD
@ -51,6 +51,9 @@ Source1: http://libguestfs.org/download/nbdkit/%{source_directory}/%{name
Source2: libguestfs.keyring
%endif
# Upstream patch to fix the --dump-config output.
Patch1: 0001-server-Fix-binary-in-dump-config-output.patch
%if 0%{patches_touch_autotools}
BuildRequires: autoconf, automake, libtool
%endif
@ -972,7 +975,7 @@ make %{?_smp_mflags} check || {
%changelog
* Sat May 2 2020 Richard W.M. Jones <rjones@redhat.com> - 1.20.0-1
* Sat May 2 2020 Richard W.M. Jones <rjones@redhat.com> - 1.20.0-2
- New upstream version 1.20.0.
* Thu Apr 30 2020 Richard W.M. Jones <rjones@redhat.com> - 1.19.12-1