From 226f143ca01cf335c7c4e3e94c96fb9d271eccc9 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 25 Jul 2017 12:24:01 +0200 Subject: 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 --- common/sysutils.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'common/sysutils.c') 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 -- cgit v1.2.3