summaryrefslogtreecommitdiff
path: root/coreutils/mkdir.c
diff options
context:
space:
mode:
authorEric Andersen2001-01-31 17:35:02 +0000
committerEric Andersen2001-01-31 17:35:02 +0000
commit65225df2dc656d3c038b22e82b2865c1db333cb2 (patch)
tree3a7d4d8bae522a66881a39ba53a6f0ba83840d60 /coreutils/mkdir.c
parent53cfb7e23145dc192c75d207cee50be1581f8dda (diff)
downloadbusybox-65225df2dc656d3c038b22e82b2865c1db333cb2.zip
busybox-65225df2dc656d3c038b22e82b2865c1db333cb2.tar.gz
Cleanup patch from Vladimir N. Oleynik.
* mkdir: remove 3 lines in source code. * mkfs_minix: save 32 bytes, remove 4 bugs. * mkswap: save 64 bytes, remove 1 bug.
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--;