From 5a6acd24a55d31a7c7e68dc4e46149598f1699a4 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Fri, 9 Jun 2017 12:33:23 +0300
Subject: [PATCH] Dont push NULL-bodied macros (in case of get_fskpass()
 failure)

---
 rpmsign.c        | 4 ++--
 sign/rpmgensig.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/rpmsign.c b/rpmsign.c
index 04738c052..578079a4d 100644
--- a/rpmsign.c
+++ b/rpmsign.c
@@ -119,9 +119,9 @@ static int doSign(poptContext optCon, struct rpmSignArgs *sargs)
 	    fileSigningKeyPassword = get_fskpass();
 	}
 
-	rpmPushMacro(NULL, "_file_signing_key_password", NULL,
-	    fileSigningKeyPassword, RMIL_CMDLINE);
 	if (fileSigningKeyPassword) {
+	    rpmPushMacro(NULL, "_file_signing_key_password", NULL,
+			fileSigningKeyPassword, RMIL_CMDLINE);
 	    memset(fileSigningKeyPassword, 0, strlen(fileSigningKeyPassword));
 	    free(fileSigningKeyPassword);
 	}
diff --git a/sign/rpmgensig.c b/sign/rpmgensig.c
index 5c04e9218..073136364 100644
--- a/sign/rpmgensig.c
+++ b/sign/rpmgensig.c
@@ -538,7 +538,7 @@ static rpmRC includeFileSignatures(FD_t fd, const char *rpm,
 
     key = rpmExpand("%{?_file_signing_key}", NULL);
 
-    keypass = rpmExpand("%{_file_signing_key_password}", NULL);
+    keypass = rpmExpand("%{?_file_signing_key_password}", NULL);
     if (rstreq(keypass, "")) {
 	free(keypass);
 	keypass = NULL;
-- 
2.11.0

