diff options
-rw-r--r-- | agent/gpg-agent.c | 6 | ||||
-rw-r--r-- | dirmngr/dirmngr.c | 13 | ||||
-rw-r--r-- | scd/scdaemon.c | 13 |
3 files changed, 26 insertions, 6 deletions
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c index efaebfd94..90e8a2657 100644 --- a/agent/gpg-agent.c +++ b/agent/gpg-agent.c @@ -39,6 +39,7 @@ # endif # include <aclapi.h> # include <sddl.h> +# include <direct.h> #else /*!HAVE_W32_SYSTEM*/ # include <sys/socket.h> # include <sys/un.h> @@ -1558,6 +1559,11 @@ main (int argc, char **argv ) (void)csh_style; (void)nodetach; initialize_modules (); + if (_chdir("\\")) + { + log_error ("chdir to / failed: %s\n", strerror (errno)); + exit (1); + } #else /*!HAVE_W32_SYSTEM*/ diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c index 6eabca9c3..b19b4180d 100644 --- a/dirmngr/dirmngr.c +++ b/dirmngr/dirmngr.c @@ -30,9 +30,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 #include <sys/stat.h> #include <unistd.h> @@ -1268,6 +1270,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); + } pid = getpid (); es_printf ("set %s=%s;%lu;1\n", 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) |