1 /* Verify that realpath returns NULL with ENAMETOOLONG if the result exceeds
3 Copyright The GNU Toolchain Authors.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
25 #include <support/check.h>
26 #include <support/temp_file.h>
27 #include <sys/types.h>
30 #define BASENAME "tst-realpath-toolong."
33 # define PATH_MAX 1024
39 char *base
= support_create_and_chdir_toolong_temp_directory (BASENAME
);
41 char buf
[PATH_MAX
+ 1];
42 const char *res
= realpath (".", buf
);
44 /* canonicalize.c states that if the real path is >= PATH_MAX, then
45 realpath returns NULL and sets ENAMETOOLONG. */
46 TEST_VERIFY (res
== NULL
);
47 TEST_VERIFY (errno
== ENAMETOOLONG
);
53 #include <support/test-driver.c>