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.
This commit is contained in:
Eric Andersen
2001-01-31 17:35:02 +00:00
parent 53cfb7e231
commit 65225df2dc
6 changed files with 76 additions and 120 deletions

View File

@@ -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--;