diff options
Diffstat (limited to 'src/regress/lib/libc/dirname')
-rw-r--r-- | src/regress/lib/libc/dirname/dirname_test.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/regress/lib/libc/dirname/dirname_test.c b/src/regress/lib/libc/dirname/dirname_test.c index 27d32b6eda..250b4def66 100644 --- a/src/regress/lib/libc/dirname/dirname_test.c +++ b/src/regress/lib/libc/dirname/dirname_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> |
@@ -16,7 +14,7 @@ | |||
16 | int | 14 | int |
17 | main(void) | 15 | main(void) |
18 | { | 16 | { |
19 | char path[2 * MAXPATHLEN]; | 17 | char path[2 * PATH_MAX]; |
20 | char dname[128]; | 18 | char dname[128]; |
21 | const char *dir = "junk"; | 19 | const char *dir = "junk"; |
22 | const char *fname = "/file.name.ext"; | 20 | const char *fname = "/file.name.ext"; |
@@ -39,7 +37,7 @@ main(void) | |||
39 | * 1) path is NULL | 37 | * 1) path is NULL |
40 | * 2) path is the empty string | 38 | * 2) path is the empty string |
41 | * 3) path is composed entirely of slashes | 39 | * 3) path is composed entirely of slashes |
42 | * 4) the resulting name is larger than MAXPATHLEN | 40 | * 4) the resulting name is larger than PATH_MAX |
43 | * | 41 | * |
44 | * The first two cases require that a pointer | 42 | * The first two cases require that a pointer |
45 | * to the string "." be returned. | 43 | * to the string "." be returned. |
@@ -62,7 +60,7 @@ main(void) | |||
62 | errx(1, "2: dirname(%s) = %s != .", path, str); | 60 | errx(1, "2: dirname(%s) = %s != .", path, str); |
63 | 61 | ||
64 | /* Case 3 */ | 62 | /* Case 3 */ |
65 | for (i = 0; i < MAXPATHLEN - 1; i++) | 63 | for (i = 0; i < PATH_MAX - 1; i++) |
66 | strlcat(path, "/", sizeof(path)); /* path cleared above */ | 64 | strlcat(path, "/", sizeof(path)); /* path cleared above */ |
67 | str = dirname(path); | 65 | str = dirname(path); |
68 | if (strcmp(str, "/") != 0) | 66 | if (strcmp(str, "/") != 0) |
@@ -70,7 +68,7 @@ main(void) | |||
70 | 68 | ||
71 | /* Case 4 */ | 69 | /* Case 4 */ |
72 | strlcpy(path, "/", sizeof(path)); /* reset path */ | 70 | strlcpy(path, "/", sizeof(path)); /* reset path */ |
73 | for (i = 0; i <= MAXPATHLEN; i += strlen(dir)) | 71 | for (i = 0; i <= PATH_MAX; i += strlen(dir)) |
74 | strlcat(path, dir, sizeof(path)); | 72 | strlcat(path, dir, sizeof(path)); |
75 | strlcat(path, fname, sizeof(path)); | 73 | strlcat(path, fname, sizeof(path)); |
76 | str = dirname(path); | 74 | str = dirname(path); |