summaryrefslogtreecommitdiff
path: root/mkdir.c
diff options
context:
space:
mode:
Diffstat (limited to 'mkdir.c')
-rw-r--r--mkdir.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/mkdir.c b/mkdir.c
index 2cd1788..9ea3b4e 100644
--- a/mkdir.c
+++ b/mkdir.c
@@ -80,17 +80,21 @@ extern int mkdir_main(int argc, char **argv)
while (argc > 0) {
int status;
struct stat statBuf;
- status=stat(*argv, &statBuf);
+ char buf[NAME_MAX];
+
+ strcpy (buf, *argv);
+ status=stat(buf, &statBuf);
if (status != -1 && status != ENOENT ) {
- fprintf(stderr, "%s: File exists\n", *argv);
+ fprintf(stderr, "%s: File exists\n", buf);
exit( FALSE);
}
if (parentFlag == TRUE) {
- createPath(*argv, mode);
+ strcat( buf, "/");
+ createPath(buf, mode);
}
else {
- if (mkdir (*argv, mode) != 0) {
- perror(*argv);
+ if (mkdir (buf, mode) != 0) {
+ perror(buf);
exit( FALSE);
}
}