/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the shm_unlink() function sets errno = ENAMETOOLONG if the length * of the name argument exceeds {PATH_MAX} (including the terminating null). * * The used name follow the scheme: * aaaaaa/aaaaaa/aaaaaa/aaa ... */ #include #include #include #include #include #include #include #include #include "posixtest.h" /* Ensure that each component length is short enough */ #define COMPONENT_SIZE _POSIX_NAME_MAX int main() { int result, i, path_max; char *shm_name; path_max = pathconf("/", _PC_PATH_MAX); if(path_max == -1) { perror("An error occurs when calling pathconf()"); return PTS_UNRESOLVED; } shm_name = malloc(path_max+1); for(i=0; i