summaryrefslogtreecommitdiff
path: root/coreutils/mkdir.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/mkdir.c')
-rw-r--r--coreutils/mkdir.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c
index 2345d88..07b1871 100644
--- a/coreutils/mkdir.c
+++ b/coreutils/mkdir.c
@@ -52,8 +52,7 @@ extern int mkdir_main(int argc, char **argv)
/* Find the specified modes */
mode = 0;
if (parse_mode(*(++argv), &mode) == FALSE) {
- error_msg("Unknown mode: %s\n", *argv);
- return EXIT_FAILURE;
+ error_msg_and_die("Unknown mode: %s\n", *argv);
}
/* Set the umask for this process so it doesn't
* screw up whatever the user just entered. */
@@ -81,22 +80,19 @@ extern int mkdir_main(int argc, char **argv)
char buf[BUFSIZ + 1];
if (strlen(*argv) > BUFSIZ - 1) {
- error_msg(name_too_long);
- return EXIT_FAILURE;
+ error_msg_and_die(name_too_long);
}
strcpy(buf, *argv);
status = stat(buf, &statBuf);
if (parentFlag == FALSE && status != -1 && errno != ENOENT) {
- error_msg("%s: File exists\n", buf);
- return EXIT_FAILURE;
+ error_msg_and_die("%s: File exists\n", buf);
}
if (parentFlag == TRUE) {
strcat(buf, "/");
create_path(buf, mode);
} else {
if (mkdir(buf, mode) != 0 && parentFlag == FALSE) {
- perror(buf);
- return EXIT_FAILURE;
+ perror_msg_and_die(buf);
}
}
argc--;