summaryrefslogtreecommitdiff
path: root/p11-kit
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2017-02-15 12:05:33 +0100
committerDaiki Ueno <ueno@gnu.org>2017-02-16 16:17:14 +0100
commit46e35810f8e9774bd5984b9fcb6d92450bf6ba0a (patch)
treebb8601a2acc453f8c6a932ec7e8cb64201a3c3f4 /p11-kit
parent69293e9e894c9a3141f8d59e78a81b3fcf2beb28 (diff)
build: Adjust executable/module names for Windows
Append EXEEXT or SHLEXT to the filename if needed.
Diffstat (limited to 'p11-kit')
-rw-r--r--p11-kit/p11-kit.c7
-rw-r--r--p11-kit/test-transport.c4
2 files changed, 8 insertions, 3 deletions
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;