From 3fc18563bf68ac13e24dee147ad3903bb5251cda Mon Sep 17 00:00:00 2001 From: Fred Wright <fw@fwright.net> Date: Sat, 23 Nov 2024 16:18:44 -0800 Subject: [PATCH] test_fdopendir: Add non-POSIX variant. This provides coverage for the non-UNIX2003 variant on 32-bit platforms. TESTED: Passes on all platforms. Generates expected references. --- test/test_fdopendir_nonposix.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/test_fdopendir_nonposix.c diff --git a/test/test_fdopendir_nonposix.c b/test/test_fdopendir_nonposix.c new file mode 100644 index 0000000..ac43b30 --- /dev/null +++ b/test/test_fdopendir_nonposix.c @@ -0,0 +1,25 @@ +/* + * Version of test_fdopendir with non-POSIX semantics (32-bit only). + * + * Attempting a 64-bit build with _NONSTD_SOURCE results in an error. + */ + +#if defined(__LP64__) && __LP64__ + +#include <libgen.h> +#include <stdio.h> + +int +main(int argc, char *argv[]) +{ + (void) argc; + printf("%s is inapplicable.\n", basename(argv[0])); + return 0; +} + +#else /* 32-bit */ + +#define _NONSTD_SOURCE +#include "test_fdopendir.c" + +#endif /* 32-bit */ -- GitLab