diff options
| author | Eric Andersen <andersen@codepoet.org> | 2001-01-31 17:35:02 +0000 |
|---|---|---|
| committer | Eric Andersen <andersen@codepoet.org> | 2001-01-31 17:35:02 +0000 |
| commit | 65225df2dc656d3c038b22e82b2865c1db333cb2 (patch) | |
| tree | 3a7d4d8bae522a66881a39ba53a6f0ba83840d60 /coreutils | |
| parent | 53cfb7e23145dc192c75d207cee50be1581f8dda (diff) | |
| download | busybox-w32-65225df2dc656d3c038b22e82b2865c1db333cb2.tar.gz busybox-w32-65225df2dc656d3c038b22e82b2865c1db333cb2.tar.bz2 busybox-w32-65225df2dc656d3c038b22e82b2865c1db333cb2.zip | |
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')
| -rw-r--r-- | coreutils/mkdir.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index 2345d8831..07b18713a 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c | |||
| @@ -52,8 +52,7 @@ extern int mkdir_main(int argc, char **argv) | |||
| 52 | /* Find the specified modes */ | 52 | /* Find the specified modes */ |
| 53 | mode = 0; | 53 | mode = 0; |
| 54 | if (parse_mode(*(++argv), &mode) == FALSE) { | 54 | if (parse_mode(*(++argv), &mode) == FALSE) { |
| 55 | error_msg("Unknown mode: %s\n", *argv); | 55 | error_msg_and_die("Unknown mode: %s\n", *argv); |
| 56 | return EXIT_FAILURE; | ||
| 57 | } | 56 | } |
| 58 | /* Set the umask for this process so it doesn't | 57 | /* Set the umask for this process so it doesn't |
| 59 | * screw up whatever the user just entered. */ | 58 | * screw up whatever the user just entered. */ |
| @@ -81,22 +80,19 @@ extern int mkdir_main(int argc, char **argv) | |||
| 81 | char buf[BUFSIZ + 1]; | 80 | char buf[BUFSIZ + 1]; |
| 82 | 81 | ||
| 83 | if (strlen(*argv) > BUFSIZ - 1) { | 82 | if (strlen(*argv) > BUFSIZ - 1) { |
| 84 | error_msg(name_too_long); | 83 | error_msg_and_die(name_too_long); |
| 85 | return EXIT_FAILURE; | ||
| 86 | } | 84 | } |
| 87 | strcpy(buf, *argv); | 85 | strcpy(buf, *argv); |
| 88 | status = stat(buf, &statBuf); | 86 | status = stat(buf, &statBuf); |
| 89 | if (parentFlag == FALSE && status != -1 && errno != ENOENT) { | 87 | if (parentFlag == FALSE && status != -1 && errno != ENOENT) { |
| 90 | error_msg("%s: File exists\n", buf); | 88 | error_msg_and_die("%s: File exists\n", buf); |
| 91 | return EXIT_FAILURE; | ||
| 92 | } | 89 | } |
| 93 | if (parentFlag == TRUE) { | 90 | if (parentFlag == TRUE) { |
| 94 | strcat(buf, "/"); | 91 | strcat(buf, "/"); |
| 95 | create_path(buf, mode); | 92 | create_path(buf, mode); |
| 96 | } else { | 93 | } else { |
| 97 | if (mkdir(buf, mode) != 0 && parentFlag == FALSE) { | 94 | if (mkdir(buf, mode) != 0 && parentFlag == FALSE) { |
| 98 | perror(buf); | 95 | perror_msg_and_die(buf); |
| 99 | return EXIT_FAILURE; | ||
| 100 | } | 96 | } |
| 101 | } | 97 | } |
| 102 | argc--; | 98 | argc--; |
