summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--p11-kit/p11-kit.c7
-rw-r--r--p11-kit/test-transport.c4
3 files changed, 10 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 3ff62cc..e192edf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -488,6 +488,8 @@ esac
AC_DEFINE_UNQUOTED(SHLEXT, ["$SHLEXT"], [File extension for shared libraries])
AC_SUBST(SHLEXT)
+AC_DEFINE_UNQUOTED(EXEEXT, ["$EXEEXT"], [File extension for executables])
+
privatedir='${libexecdir}/p11-kit'
AC_SUBST(privatedir)
diff --git a/p11-kit/p11-kit.c b/p11-kit/p11-kit.c
index a7b9212..7a90046 100644
--- a/p11-kit/p11-kit.c
+++ b/p11-kit/p11-kit.c
@@ -105,7 +105,7 @@ p11_kit_external (int argc,
return p11_kit_trust (argc, argv);
}
- if (asprintf (&filename, "p11-kit-%s", argv[0]) < 0)
+ if (asprintf (&filename, "p11-kit-%s%s", argv[0], EXEEXT) < 0)
return_val_if_reached (1);
private_dir = secure_getenv ("P11_KIT_PRIVATEDIR");
@@ -116,6 +116,11 @@ p11_kit_external (int argc,
path = p11_path_build (private_dir, filename, NULL);
return_val_if_fail (path != NULL, 1);
+ /* Windows execv() requires the first element of ARGV must be
+ * the executable name */
+#ifdef OS_WIN32
+ argv[0] = path;
+#endif
argv[argc] = NULL;
execv (path, argv);
diff --git a/p11-kit/test-transport.c b/p11-kit/test-transport.c
index db0c4dd..86e5e87 100644
--- a/p11-kit/test-transport.c
+++ b/p11-kit/test-transport.c
@@ -75,9 +75,9 @@ setup_remote (void *unused)
p11_test_file_write (NULL, test.user_config, data, strlen (data));
setenv ("P11_KIT_PRIVATEDIR", BUILDDIR, 1);
- data = "remote: |" BUILDDIR "/p11-kit/p11-kit remote " BUILDDIR "/.libs/mock-two.so\n";
+ data = "remote: |" BUILDDIR "/p11-kit/p11-kit" EXEEXT " remote " BUILDDIR "/.libs/mock-two" SHLEXT "\n";
p11_test_file_write (test.user_modules, "remote.module", data, strlen (data));
- data = "remote: |" BUILDDIR "/p11-kit/p11-kit remote " BUILDDIR "/.libs/mock-five.so\nx-init-reserved: initialize-arg";
+ data = "remote: |" BUILDDIR "/p11-kit/p11-kit" EXEEXT " remote " BUILDDIR "/.libs/mock-five" SHLEXT "\nx-init-reserved: initialize-arg";
p11_test_file_write (test.user_modules, "init-arg.module", data, strlen (data));
p11_config_user_modules = test.user_modules;