Home GnuPG
Diffusion GnuPG 226f143ca01c

common: New functions gnupg_daemon_rootdir and gnupg_chdir.

Description

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>

Details

Provenance
wernerAuthored on Jul 25 2017, 12:24 PM
Parents
rGf2d2648a4deb: Revert "w32: Change directory on daemon startup."
Branches
Unknown
Tags
Unknown

Event Timeline

aheinecke added inline comments.
/common/sysutils.c
799

Nit: If the encoding is explicitly mentioned in the comment I would expect a conversion to the filesystem locale. Using UTF-8 will fail for most unicode filenames on Windows and even on Linux not everyone uses UTF-8

For Windows you could do a utf8_to_wchar and use _wchdir

But meh maybe a FIXME? ;-)

/common/sysutils.c
799

That was just to clarify the API of the function. I know that it won't work with non-ascii but chdir won't work either and we need to switch to SetCurrentDirectory. There are several functions which are not utf8 ready on Windows.