diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/all-tests.scm | 52 | ||||
-rw-r--r-- | common/sysutils.c | 22 |
2 files changed, 42 insertions, 32 deletions
diff --git a/common/all-tests.scm b/common/all-tests.scm index 54f1153a5..7ff7d244d 100644 --- a/common/all-tests.scm +++ b/common/all-tests.scm @@ -19,27 +19,31 @@ ;; XXX: Currently, the makefile parser does not understand this ;; Makefile.am, so we hardcode the list of tests here. (map (lambda (name) - (test::binary #f - (path-join "common" name) - (path-join (getenv "objdir") "common" name))) - (list "t-stringhelp" - "t-timestuff" - "t-convert" - "t-percent" - "t-gettime" - "t-sysutils" - "t-sexputil" - "t-session-env" - "t-openpgp-oid" - "t-ssh-utils" - "t-mapstrings" - "t-zb32" - "t-mbox-util" - "t-iobuf" - "t-strlist" - "t-name-value" - "t-ccparray" - "t-recsel" - "t-exechelp" - "t-exectool" - ))) + (let ((name-ext (string-append name (getenv "EXEEXT")))) + (test::binary #f + (path-join "common" name-ext) + (path-join (getenv "objdir") "common" name-ext)))) + `("t-stringhelp" + "t-timestuff" + "t-convert" + "t-percent" + "t-gettime" + "t-sysutils" + "t-sexputil" + "t-session-env" + "t-openpgp-oid" + "t-ssh-utils" + "t-mapstrings" + "t-zb32" + "t-mbox-util" + "t-iobuf" + "t-strlist" + "t-name-value" + "t-ccparray" + "t-recsel" + ,@(if *win32* + '("t-w32-reg" + "t-w32-cmdline") + '("t-exechelp" + "t-exectool")) + ))) diff --git a/common/sysutils.c b/common/sysutils.c index bbed309a8..01510ddb0 100644 --- a/common/sysutils.c +++ b/common/sysutils.c @@ -609,7 +609,7 @@ gnupg_tmpfile (void) char *name, *p; HANDLE file; int pid = GetCurrentProcessId (); - unsigned int value; + unsigned int value = 0; int i; SECURITY_ATTRIBUTES sec_attr; @@ -634,12 +634,9 @@ gnupg_tmpfile (void) for (attempts=0; attempts < 10; attempts++) { p = name; - value = (GetTickCount () ^ ((pid<<16) & 0xffff0000)); + value += (GetTickCount () ^ ((pid<<16) & 0xffff0000)); for (i=0; i < 8; i++) - { - *p++ = tohex (((value >> 28) & 0x0f)); - value <<= 4; - } + *p++ = tohex (((value >> (7 - i)*4) & 0x0f)); strcpy (p, ".tmp"); file = CreateFile (buffer, GENERIC_READ | GENERIC_WRITE, @@ -1195,19 +1192,28 @@ gnupg_unsetenv (const char *name) #else /*!HAVE_UNSETENV*/ { char *buf; + int r; if (!name) { gpg_err_set_errno (EINVAL); return -1; } - buf = xtrystrdup (name); + buf = strconcat (name, "=", NULL); if (!buf) return -1; + + r = putenv (buf); +# ifdef HAVE_W32_SYSTEM + /* For Microsoft implementation, we can free the memory in this + use case. */ + xfree (buf); +# else # if __GNUC__ # warning no unsetenv - trying putenv but leaking memory. # endif - return putenv (buf); +# endif + return r; } #endif /*!HAVE_UNSETENV*/ } |