diff options
Diffstat (limited to 'src/regress/lib/libc/basename')
-rw-r--r-- | src/regress/lib/libc/basename/basename_test.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/regress/lib/libc/basename/basename_test.c b/src/regress/lib/libc/basename/basename_test.c index 34e138c726..7272c46b1d 100644 --- a/src/regress/lib/libc/basename/basename_test.c +++ b/src/regress/lib/libc/basename/basename_test.c | |||
@@ -4,8 +4,6 @@ | |||
4 | * Public domain. | 4 | * Public domain. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <sys/param.h> | ||
8 | |||
9 | #include <libgen.h> | 7 | #include <libgen.h> |
10 | #include <stdio.h> | 8 | #include <stdio.h> |
11 | #include <string.h> | 9 | #include <string.h> |
@@ -15,7 +13,7 @@ | |||
15 | int | 13 | int |
16 | main(void) | 14 | main(void) |
17 | { | 15 | { |
18 | char path[2 * MAXPATHLEN]; | 16 | char path[2 * PATH_MAX]; |
19 | const char *dir = "junk/"; | 17 | const char *dir = "junk/"; |
20 | const char *fname = "file.name.ext"; | 18 | const char *fname = "file.name.ext"; |
21 | char *str; | 19 | char *str; |
@@ -35,7 +33,7 @@ main(void) | |||
35 | * 1) path is NULL | 33 | * 1) path is NULL |
36 | * 2) path is the empty string | 34 | * 2) path is the empty string |
37 | * 3) path is composed entirely of slashes | 35 | * 3) path is composed entirely of slashes |
38 | * 4) the resulting name is larger than MAXPATHLEN | 36 | * 4) the resulting name is larger than PATH_MAX |
39 | * | 37 | * |
40 | * The first two cases require that a pointer | 38 | * The first two cases require that a pointer |
41 | * to the string "." be returned. | 39 | * to the string "." be returned. |
@@ -58,7 +56,7 @@ main(void) | |||
58 | goto fail; | 56 | goto fail; |
59 | 57 | ||
60 | /* Case 3 */ | 58 | /* Case 3 */ |
61 | for (i = 0; i < MAXPATHLEN - 1; i++) | 59 | for (i = 0; i < PATH_MAX - 1; i++) |
62 | strlcat(path, "/", sizeof(path)); /* path cleared above */ | 60 | strlcat(path, "/", sizeof(path)); /* path cleared above */ |
63 | str = basename(path); | 61 | str = basename(path); |
64 | if (strcmp(str, "/") != 0) | 62 | if (strcmp(str, "/") != 0) |
@@ -67,7 +65,7 @@ main(void) | |||
67 | /* Case 4 */ | 65 | /* Case 4 */ |
68 | strlcpy(path, "/", sizeof(path)); | 66 | strlcpy(path, "/", sizeof(path)); |
69 | strlcat(path, dir, sizeof(path)); | 67 | strlcat(path, dir, sizeof(path)); |
70 | for (i = 0; i <= MAXPATHLEN; i += sizeof(fname)) | 68 | for (i = 0; i <= PATH_MAX; i += sizeof(fname)) |
71 | strlcat(path, fname, sizeof(path)); | 69 | strlcat(path, fname, sizeof(path)); |
72 | str = basename(path); | 70 | str = basename(path); |
73 | if (str != NULL || errno != ENAMETOOLONG) | 71 | if (str != NULL || errno != ENAMETOOLONG) |