summaryrefslogtreecommitdiffstats
path: root/common/sysutils.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2017-07-25 12:24:01 +0200
committerWerner Koch <wk@gnupg.org>2017-07-25 12:43:37 +0200
commit226f143ca01cf335c7c4e3e94c96fb9d271eccc9 (patch)
treebf998fd0bb8459a74fe5ca339c4fa114fcd79f36 /common/sysutils.c
parentRevert "w32: Change directory on daemon startup." (diff)
downloadgnupg2-226f143ca01cf335c7c4e3e94c96fb9d271eccc9.tar.xz
gnupg2-226f143ca01cf335c7c4e3e94c96fb9d271eccc9.zip
common: New functions gnupg_daemon_rootdir and gnupg_chdir.
* common/sysutils.c (gnupg_chdir): New. * common/homedir.c (gnupg_daemon_rootdir): New. * agent/gpg-agent.c (main): Use these functions instead chdir("/"). * dirmngr/dirmngr.c (main): Ditto. * scd/scdaemon.c (main): Ditto. -- Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'common/sysutils.c')
-rw-r--r--common/sysutils.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/common/sysutils.c b/common/sysutils.c
index 1aa2e5314..e90010c44 100644
--- a/common/sysutils.c
+++ b/common/sysutils.c
@@ -796,6 +796,15 @@ gnupg_mkdir (const char *name, const char *modestr)
}
+/* A simple wrapper around chdir. NAME is expected to be utf8
+ * encoded. */
+int
+gnupg_chdir (const char *name)
+{
+ return chdir (name);
+}
+
+
/* A wrapper around chmod which takes a string for the mode argument.
This makes it easier to handle the mode argument which is not
defined on all systems. The format of the modestring is the same