aboutsummaryrefslogtreecommitdiffstats
path: root/common/sysutils.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2020-08-21 19:16:58 +0000
committerWerner Koch <[email protected]>2020-08-21 19:17:48 +0000
commiteec70e539e44c288068f26f190d52a5718fd3a10 (patch)
tree8fbfcf80a549c277eb2de71bdf879aa369fc11fe /common/sysutils.c
parentcommon,w32: Do not assume the ANSI code during string conversion. (diff)
downloadgnupg-eec70e539e44c288068f26f190d52a5718fd3a10.tar.gz
gnupg-eec70e539e44c288068f26f190d52a5718fd3a10.zip
common: Use gpgrt functions for mkdir and chdir.
* common/sysutils.c (gnupg_mkdir): Divert to gpgrt_mkdir. (gnupg_chdir): Divert to gpgrt_chdir
Diffstat (limited to '')
-rw-r--r--common/sysutils.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/common/sysutils.c b/common/sysutils.c
index 5f541938b..efc2dfe9b 100644
--- a/common/sysutils.c
+++ b/common/sysutils.c
@@ -795,29 +795,9 @@ modestr_to_mode (const char *modestr)
int
gnupg_mkdir (const char *name, const char *modestr)
{
-#ifdef HAVE_W32CE_SYSTEM
- wchar_t *wname;
- (void)modestr;
-
- wname = utf8_to_wchar (name);
- if (!wname)
- return -1;
- if (!CreateDirectoryW (wname, NULL))
- {
- xfree (wname);
- return -1; /* ERRNO is automagically provided by gpg-error.h. */
- }
- xfree (wname);
- return 0;
-#elif MKDIR_TAKES_ONE_ARG
- (void)modestr;
- /* Note: In the case of W32 we better use CreateDirectory and try to
- set appropriate permissions. However using mkdir is easier
- because this sets ERRNO. */
- return mkdir (name);
-#else
- return mkdir (name, modestr_to_mode (modestr));
-#endif
+ /* Note that gpgrt_mkdir also sets ERRNO in addition to returing an
+ * gpg-error style error code. */
+ return gpgrt_mkdir (name, modestr);
}
@@ -826,7 +806,9 @@ gnupg_mkdir (const char *name, const char *modestr)
int
gnupg_chdir (const char *name)
{
- return chdir (name);
+ /* Note that gpgrt_chdir also sets ERRNO in addition to returing an
+ * gpg-error style error code. */
+ return gpgrt_chdir (name);
}