aboutsummaryrefslogtreecommitdiffstats
path: root/common/homedir.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/homedir.c')
-rw-r--r--common/homedir.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/common/homedir.c b/common/homedir.c
index d0fc5c631..5adf46a62 100644
--- a/common/homedir.c
+++ b/common/homedir.c
@@ -23,6 +23,9 @@
#include <fcntl.h>
#ifdef HAVE_W32_SYSTEM
+# ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+# endif
#include <shlobj.h>
#ifndef CSIDL_APPDATA
#define CSIDL_APPDATA 0x001a
@@ -97,7 +100,7 @@ standard_homedir (void)
if (!dir)
{
char path[MAX_PATH];
-
+
/* It might be better to use LOCAL_APPDATA because this is
defined as "non roaming" and thus more likely to be kept
locally. For private keys this is desired. However, given
@@ -105,13 +108,13 @@ standard_homedir (void)
using a system roaming services might be better than to let
them do it manually. A security conscious user will anyway
use the registry entry to have better control. */
- if (w32_shgetfolderpath (NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE,
- NULL, 0, path) >= 0)
+ if (w32_shgetfolderpath (NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE,
+ NULL, 0, path) >= 0)
{
char *tmp = xmalloc (strlen (path) + 6 +1);
strcpy (stpcpy (tmp, path), "\\gnupg");
dir = tmp;
-
+
/* Try to create the directory if it does not yet exists. */
if (access (dir, F_OK))
CreateDirectory (dir, NULL);
@@ -137,7 +140,7 @@ default_homedir (void)
if (!dir || !*dir)
{
static const char *saved_dir;
-
+
if (!saved_dir)
{
if (!dir || !*dir)
@@ -154,7 +157,7 @@ default_homedir (void)
if (tmp)
saved_dir = tmp;
}
-
+
if (!saved_dir)
saved_dir = standard_homedir ();
}
@@ -191,7 +194,7 @@ w32_rootdir (void)
else
{
log_debug ("bad filename `%s' returned for this process\n", dir);
- *dir = 0;
+ *dir = 0;
}
}
@@ -210,8 +213,8 @@ w32_commondir (void)
{
char path[MAX_PATH];
- if (w32_shgetfolderpath (NULL, CSIDL_COMMON_APPDATA,
- NULL, 0, path) >= 0)
+ if (w32_shgetfolderpath (NULL, CSIDL_COMMON_APPDATA,
+ NULL, 0, path) >= 0)
{
char *tmp = xmalloc (strlen (path) + 4 +1);
strcpy (stpcpy (tmp, path), "\\GNU");
@@ -226,7 +229,7 @@ w32_commondir (void)
dir = xstrdup (w32_rootdir ());
}
}
-
+
return dir;
}
#endif /*HAVE_W32_SYSTEM*/
@@ -388,42 +391,42 @@ gnupg_module_name (int which)
strcpy (stpcpy (name, s), s2); \
} \
return name; \
- } while (0)
+ } while (0)
switch (which)
{
case GNUPG_MODULE_NAME_AGENT:
#ifdef GNUPG_DEFAULT_AGENT
return GNUPG_DEFAULT_AGENT;
-#else
+#else
X(bindir, "gpg-agent");
#endif
-
+
case GNUPG_MODULE_NAME_PINENTRY:
#ifdef GNUPG_DEFAULT_PINENTRY
return GNUPG_DEFAULT_PINENTRY;
-#else
+#else
X(bindir, "pinentry");
#endif
case GNUPG_MODULE_NAME_SCDAEMON:
#ifdef GNUPG_DEFAULT_SCDAEMON
return GNUPG_DEFAULT_SCDAEMON;
-#else
+#else
X(libexecdir, "scdaemon");
#endif
case GNUPG_MODULE_NAME_DIRMNGR:
#ifdef GNUPG_DEFAULT_DIRMNGR
return GNUPG_DEFAULT_DIRMNGR;
-#else
+#else
X(bindir, "dirmngr");
#endif
case GNUPG_MODULE_NAME_PROTECT_TOOL:
#ifdef GNUPG_DEFAULT_PROTECT_TOOL
return GNUPG_DEFAULT_PROTECT_TOOL;
-#else
+#else
X(libexecdir, "gpg-protect-tool");
#endif
@@ -442,7 +445,7 @@ gnupg_module_name (int which)
case GNUPG_MODULE_NAME_GPGCONF:
X(bindir, "gpgconf");
- default:
+ default:
BUG ();
}
#undef X