aboutsummaryrefslogtreecommitdiffstats
path: root/scd/scdaemon.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <[email protected]>2017-07-24 14:31:55 +0000
committerMarcus Brinkmann <[email protected]>2017-07-24 14:31:55 +0000
commit78ebc62604d77600b9865950610717d28c6027a2 (patch)
treef7027a1ee81eb180eab71cf6ef32bf08da117d50 /scd/scdaemon.c
parentg10: Make sure to emit NEED_PASSPHRASE on --export-secret-key. (diff)
downloadgnupg-78ebc62604d77600b9865950610717d28c6027a2.tar.gz
gnupg-78ebc62604d77600b9865950610717d28c6027a2.zip
w32: Change directory on daemon startup.
* agent/gpg-agent.c [HAVE_W32_SYSTEM]: Include <direct.h>. (main) [HAVE_W32_SYSTEM]: Change working directory to \. * dirmngr/dirmngr.c [HAVE_W32_SYSTEM]: Include <direct.h>. (main) [HAVE_W32_SYSTEM]: Change working directory to \. * scd/scdaemon.c [HAVE_W32_SYSTEM]: Include <direct.h>. (main) [HAVE_W32_SYSTEM]: Change working directory to \. Signed-off-by: Marcus Brinkmann <[email protected]> GnuPG-bug-id: 2670
Diffstat (limited to '')
-rw-r--r--scd/scdaemon.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/scd/scdaemon.c b/scd/scdaemon.c
index 26e89dd8d..bbb043334 100644
--- a/scd/scdaemon.c
+++ b/scd/scdaemon.c
@@ -29,9 +29,11 @@
#include <assert.h>
#include <time.h>
#include <fcntl.h>
-#ifndef HAVE_W32_SYSTEM
-#include <sys/socket.h>
-#include <sys/un.h>
+#ifdef HAVE_W32_SYSTEM
+# include <direct.h>
+#else
+# include <sys/socket.h>
+# include <sys/un.h>
#endif /*HAVE_W32_SYSTEM*/
#include <unistd.h>
#include <signal.h>
@@ -811,6 +813,11 @@ main (int argc, char **argv )
#ifdef HAVE_W32_SYSTEM
(void)csh_style;
(void)nodetach;
+ if (_chdir("\\"))
+ {
+ log_error ("chdir to / failed: %s\n", strerror (errno));
+ exit (1);
+ }
#else
pid = fork ();
if (pid == (pid_t)-1)