diff options
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/dd.c | 5 | ||||
-rw-r--r-- | coreutils/mkdir.c | 14 |
2 files changed, 14 insertions, 5 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c index 64948571c..a2dc1c396 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c | |||
@@ -29,10 +29,15 @@ | |||
29 | 29 | ||
30 | 30 | ||
31 | #include "internal.h" | 31 | #include "internal.h" |
32 | #include <features.h> | ||
32 | #include <stdio.h> | 33 | #include <stdio.h> |
33 | #include <fcntl.h> | 34 | #include <fcntl.h> |
34 | #include <errno.h> | 35 | #include <errno.h> |
36 | #if (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1) | ||
35 | #include <inttypes.h> | 37 | #include <inttypes.h> |
38 | #else | ||
39 | typedef unsigned long long int uintmax_t; | ||
40 | #endif | ||
36 | 41 | ||
37 | static const char dd_usage[] = | 42 | static const char dd_usage[] = |
38 | "dd [if=name] [of=name] [bs=n] [count=n]\n\n" | 43 | "dd [if=name] [of=name] [bs=n] [count=n]\n\n" |
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index 2cd178805..9ea3b4ea0 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c | |||
@@ -80,17 +80,21 @@ extern int mkdir_main(int argc, char **argv) | |||
80 | while (argc > 0) { | 80 | while (argc > 0) { |
81 | int status; | 81 | int status; |
82 | struct stat statBuf; | 82 | struct stat statBuf; |
83 | status=stat(*argv, &statBuf); | 83 | char buf[NAME_MAX]; |
84 | |||
85 | strcpy (buf, *argv); | ||
86 | status=stat(buf, &statBuf); | ||
84 | if (status != -1 && status != ENOENT ) { | 87 | if (status != -1 && status != ENOENT ) { |
85 | fprintf(stderr, "%s: File exists\n", *argv); | 88 | fprintf(stderr, "%s: File exists\n", buf); |
86 | exit( FALSE); | 89 | exit( FALSE); |
87 | } | 90 | } |
88 | if (parentFlag == TRUE) { | 91 | if (parentFlag == TRUE) { |
89 | createPath(*argv, mode); | 92 | strcat( buf, "/"); |
93 | createPath(buf, mode); | ||
90 | } | 94 | } |
91 | else { | 95 | else { |
92 | if (mkdir (*argv, mode) != 0) { | 96 | if (mkdir (buf, mode) != 0) { |
93 | perror(*argv); | 97 | perror(buf); |
94 | exit( FALSE); | 98 | exit( FALSE); |
95 | } | 99 | } |
96 | } | 100 | } |