1 /* Test of dirfd() function.
2 Copyright (C) 2023-2024 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2023. */
30 #if defined _WIN32 && !defined __CYGWIN__
31 fprintf (stderr
, "Skipping test: The DIR type does not contain a file descriptor.\n");
34 /* On all other platforms, we expect to have either
35 - a dirfd() function, or
37 - a DIR struct with a d_fd member, or
38 - a DIR struct with a dd_fd member.
39 If we don't have this, dirfd.c produces a function that always returns -1.
40 Check here that this does not happen. */
41 DIR *d
= opendir (".");
45 return test_exit_status
;