[gmime] Unset environment variables that gpg-agent uses in the unit tests



commit cb539b87bb17df17180b2bd67474c6175fe0aaa3
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date:   Fri Dec 2 09:12:55 2016 -0500

    Unset environment variables that gpg-agent uses in the unit tests
    
    Thanks to Daniel Kahn Gillmor for this patch

 tests/testsuite.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/tests/testsuite.c b/tests/testsuite.c
index a575939..fa4fd9c 100644
--- a/tests/testsuite.c
+++ b/tests/testsuite.c
@@ -354,9 +354,17 @@ testsuite_setup_gpghome (void)
                return EXIT_FAILURE;
        if (system ("/bin/mkdir ./tmp") != 0)
                return EXIT_FAILURE;
-       setenv ("GNUPGHOME", "./tmp/.gnupg", 1);
+       
+       g_setenv ("GNUPGHOME", "./tmp/.gnupg", 1);
+
+       /* disable environment variables that gpg-agent uses for pinentry */
+       g_unsetenv ("DBUS_SESSION_BUS_ADDRESS");
+       g_unsetenv ("DISPLAY");
+       g_unsetenv ("GPG_TTY");
+       
        if (system ("gpg --list-keys > /dev/null 2>&1") != 0)
                return EXIT_FAILURE;
+       
        return EXIT_SUCCESS;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]