From 8fae14f4dfc655dabd3de11be4d7e9b7c1cb6898 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Fri, 9 Jun 2017 11:37:03 +0300
Subject: [PATCH] Remove bunch of redundant environ declarations

rpmsign.c used to actually use "environ" to pass to execve(), but
that call moved to librpmsign a long, long time ago. rpmdb.c and
rpmkeys.c never used it at all but guess it was copy-paste inherited
from rpmsign.c back in the day (dfbaa77152ccf98524c4f27afe85d32e6f690522)

rpmgensig.c actually refers to environ, but this is a POSIX required
variable and while Apple has managed to screw it up, it's handled
in system.h and that must be sufficient for all relevant systems
as we also refer to environ in rpmfileutil.c open_dso() and there's
no fake environ definition there. So drop the one in rpmgensig.c too.
---
 rpmdb.c          | 4 ----
 rpmkeys.c        | 4 ----
 rpmsign.c        | 4 ----
 sign/rpmgensig.c | 4 ----
 4 files changed, 16 deletions(-)

diff --git a/rpmdb.c b/rpmdb.c
index 67630d00c..25c088da9 100644
--- a/rpmdb.c
+++ b/rpmdb.c
@@ -6,10 +6,6 @@
 #include "cliutils.h"
 #include "debug.h"
 
-#if !defined(__GLIBC__) && !defined(__APPLE__)
-char ** environ = NULL;
-#endif
-
 enum modes {
     MODE_INITDB		= (1 << 0),
     MODE_REBUILDDB	= (1 << 1),
diff --git a/rpmkeys.c b/rpmkeys.c
index 0ecc65ed1..2b60a729e 100644
--- a/rpmkeys.c
+++ b/rpmkeys.c
@@ -5,10 +5,6 @@
 #include "cliutils.h"
 #include "debug.h"
 
-#if !defined(__GLIBC__) && !defined(__APPLE__)
-char ** environ = NULL;
-#endif
-
 enum modes {
     MODE_CHECKSIG	= (1 << 0),
     MODE_IMPORTKEY	= (1 << 1),
diff --git a/rpmsign.c b/rpmsign.c
index dce342af0..04738c052 100644
--- a/rpmsign.c
+++ b/rpmsign.c
@@ -9,10 +9,6 @@
 #include "cliutils.h"
 #include "debug.h"
 
-#if !defined(__GLIBC__) && !defined(__APPLE__)
-char ** environ = NULL;
-#endif
-
 enum modes {
     MODE_NONE    = 0,
     MODE_ADDSIGN = (1 << 0),
diff --git a/sign/rpmgensig.c b/sign/rpmgensig.c
index 141ad1530..5c04e9218 100644
--- a/sign/rpmgensig.c
+++ b/sign/rpmgensig.c
@@ -25,10 +25,6 @@
 
 #include "debug.h"
 
-#if !defined(__GLIBC__) && !defined(__APPLE__)
-char ** environ = NULL;
-#endif
-
 typedef struct sigTarget_s {
     FD_t fd;
     const char *fileName;
-- 
2.11.0

