diff options
Diffstat (limited to 'utility.c')
-rw-r--r-- | utility.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -47,7 +47,6 @@ | |||
47 | #include <sys/stat.h> | 47 | #include <sys/stat.h> |
48 | #include <unistd.h> | 48 | #include <unistd.h> |
49 | #include <ctype.h> | 49 | #include <ctype.h> |
50 | #include <sys/param.h> /* for PATH_MAX */ | ||
51 | #include <sys/utsname.h> /* for uname(2) */ | 50 | #include <sys/utsname.h> /* for uname(2) */ |
52 | 51 | ||
53 | #if defined BB_FEATURE_MOUNT_LOOP | 52 | #if defined BB_FEATURE_MOUNT_LOOP |
@@ -289,12 +288,12 @@ copyFile(const char *srcName, const char *destName, | |||
289 | return FALSE; | 288 | return FALSE; |
290 | } | 289 | } |
291 | } else if (S_ISLNK(srcStatBuf.st_mode)) { | 290 | } else if (S_ISLNK(srcStatBuf.st_mode)) { |
292 | char link_val[PATH_MAX + 1]; | 291 | char link_val[BUFSIZ + 1]; |
293 | int link_size; | 292 | int link_size; |
294 | 293 | ||
295 | //fprintf(stderr, "copying link %s to %s\n", srcName, destName); | 294 | //fprintf(stderr, "copying link %s to %s\n", srcName, destName); |
296 | /* Warning: This could possibly truncate silently, to PATH_MAX chars */ | 295 | /* Warning: This could possibly truncate silently, to BUFSIZ chars */ |
297 | link_size = readlink(srcName, &link_val[0], PATH_MAX); | 296 | link_size = readlink(srcName, &link_val[0], BUFSIZ); |
298 | if (link_size < 0) { | 297 | if (link_size < 0) { |
299 | perror(srcName); | 298 | perror(srcName); |
300 | return FALSE; | 299 | return FALSE; |
@@ -602,13 +601,13 @@ int recursiveAction(const char *fileName, | |||
602 | } | 601 | } |
603 | } | 602 | } |
604 | while ((next = readdir(dir)) != NULL) { | 603 | while ((next = readdir(dir)) != NULL) { |
605 | char nextFile[PATH_MAX + 1]; | 604 | char nextFile[BUFSIZ + 1]; |
606 | 605 | ||
607 | if ((strcmp(next->d_name, "..") == 0) | 606 | if ((strcmp(next->d_name, "..") == 0) |
608 | || (strcmp(next->d_name, ".") == 0)) { | 607 | || (strcmp(next->d_name, ".") == 0)) { |
609 | continue; | 608 | continue; |
610 | } | 609 | } |
611 | if (strlen(fileName) + strlen(next->d_name) + 1 > PATH_MAX) { | 610 | if (strlen(fileName) + strlen(next->d_name) + 1 > BUFSIZ) { |
612 | fprintf(stderr, name_too_long, "ftw"); | 611 | fprintf(stderr, name_too_long, "ftw"); |
613 | return FALSE; | 612 | return FALSE; |
614 | } | 613 | } |
@@ -658,7 +657,7 @@ extern int createPath(const char *name, int mode) | |||
658 | { | 657 | { |
659 | char *cp; | 658 | char *cp; |
660 | char *cpOld; | 659 | char *cpOld; |
661 | char buf[PATH_MAX + 1]; | 660 | char buf[BUFSIZ + 1]; |
662 | int retVal = 0; | 661 | int retVal = 0; |
663 | 662 | ||
664 | strcpy(buf, name); | 663 | strcpy(buf, name); |