From 4764c5a3a4d704b3b42bafc5eba3996579030703 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 19 Oct 2020 15:21:59 +0200 Subject: New public function gpgrt_access. * src/gpg-error.h.in (gpgrt_access): New. * src/gpg-error.vers. src/gpg-error.def.in: Add new function. * src/sysutils.c (any8bitchar): New. (_gpgrt_access): New. * src/visibility.c (gpgrt_access): New. * src/spawn-w32.c (_gpgrt_spawn_process_detached): Use it. * src/argparse.c (try_versioned_conffile): Use it. * tests/t-stringutils.c (check_access): New simple test. -- This is basically a wrapper to allow handling of utf8 encoded file names on Windows. This also fixes the case for versioned config files in directories with non-ascii characters. The new test needs to be run manually on Windows using a directory with Unicode characters. GnuPG-bug-id: 5098 --- tests/t-stringutils.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests') diff --git a/tests/t-stringutils.c b/tests/t-stringutils.c index a7351e5..8879e1a 100644 --- a/tests/t-stringutils.c +++ b/tests/t-stringutils.c @@ -325,6 +325,21 @@ check_absfnameconcat (void) } +static void +check_access (void) +{ + char *cwd = mygetcwd (); + + if (gpgrt_access (cwd, F_OK)) + fail ("gpgrt_access(%s) failed: %s\n", + cwd, gpg_strerror (gpg_error_from_syserror ())); + else + show ("gpgrt_access(%s) succeeded\n", cwd); + + xfree (cwd); +} + + int main (int argc, char **argv) { @@ -373,6 +388,7 @@ main (int argc, char **argv) check_fnameconcat (); check_absfnameconcat (); + check_access (); show ("testing string utilities finished\n"); return !!errorcount; -- cgit v1.2.1