diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 1999-11-22 07:41:00 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 1999-11-22 07:41:00 +0000 |
commit | a97e1d1f07821e7d508dd7e5280583a5a6d5df4f (patch) | |
tree | 9fed0b9a9a44389618c13d8094b26224355d3108 /coreutils/mkdir.c | |
parent | 17f534f1048c52c064ff9e8135840f430022fd5f (diff) | |
download | busybox-w32-a97e1d1f07821e7d508dd7e5280583a5a6d5df4f.tar.gz busybox-w32-a97e1d1f07821e7d508dd7e5280583a5a6d5df4f.tar.bz2 busybox-w32-a97e1d1f07821e7d508dd7e5280583a5a6d5df4f.zip |
Bug fixes
git-svn-id: svn://busybox.net/trunk/busybox@115 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'coreutils/mkdir.c')
-rw-r--r-- | coreutils/mkdir.c | 14 |
1 files changed, 9 insertions, 5 deletions
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 | } |