x86: Optimize svml_s_tanhf4_core_sse4.S
[glibc.git] / stdlib / tst-realpath-toolong.c
blob438889029437460141fb29bb23945dfc941ce909
1 /* Verify that realpath returns NULL with ENAMETOOLONG if the result exceeds
2 NAME_MAX.
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/>. */
20 #include <errno.h>
21 #include <limits.h>
22 #include <stdlib.h>
23 #include <string.h>
24 #include <unistd.h>
25 #include <support/check.h>
26 #include <support/temp_file.h>
27 #include <sys/types.h>
28 #include <sys/stat.h>
30 #define BASENAME "tst-realpath-toolong."
32 #ifndef PATH_MAX
33 # define PATH_MAX 1024
34 #endif
36 int
37 do_test (void)
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);
49 free (base);
50 return 0;
53 #include <support/test-driver.c>