aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMike Smith <msmith@FreeBSD.org>1998-10-23 06:28:40 +0000
committerMike Smith <msmith@FreeBSD.org>1998-10-23 06:28:40 +0000
commite45520f76e36200d0f4107a4e9ed8a7099fba662 (patch)
tree4ff648ed6ca4bb34bca4490e2c02f1d48ba067c2 /bin
parent9fcfb650d1733bc9d84a7d4ebd465d66ad2bff6c (diff)
Notes
Diffstat (limited to 'bin')
-rw-r--r--bin/mkdir/mkdir.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/bin/mkdir/mkdir.c b/bin/mkdir/mkdir.c
index 89e9ebafb6e6..84b05dffe4cd 100644
--- a/bin/mkdir/mkdir.c
+++ b/bin/mkdir/mkdir.c
@@ -63,7 +63,7 @@ main(argc, argv)
int argc;
char *argv[];
{
- int ch, exitval, omode, pflag;
+ int ch, exitval, success, omode, pflag;
mode_t *set = (mode_t *)NULL;
char *mode;
@@ -96,13 +96,16 @@ main(argc, argv)
}
for (exitval = 0; *argv != NULL; ++argv) {
+ success = 1;
if (pflag) {
if (build(*argv, omode))
- exitval = 1;
+ success = 0;
} else if (mkdir(*argv, omode) < 0) {
warn("%s", *argv);
- exitval = 1;
+ success = 0;
}
+ if (!success)
+ exitval = 1;
/*
* The mkdir() and umask() calls both honor only the low
* nine bits, so if you try to set a mode including the
@@ -110,9 +113,8 @@ main(argc, argv)
* this unless the user has specifically requested a mode,
* as chmod will (obviously) ignore the umask.
*/
- if ((exitval == 0) &&
- (mode != NULL) && (chmod(*argv, omode) == -1)) {
- warn("chmod %s", *argv);
+ if (success && mode != NULL && chmod(*argv, omode) == -1) {
+ warn("%s", *argv);
exitval = 1;
}
}