/* 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. */
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--;