commit 87f40834a329f4f526fd17b1be36c75da0323573
parent aded9028919a819407ec633473d320e689f2fdb9
Author: Michael Forney <mforney@mforney.org>
Date: Wed, 30 Nov 2016 23:27:59 -0800
parsemode: No need to return after eprintf
Also, since parsemode exits on failure, don't bother checking return
value in xinstall (this would never trigger anyway because mode_t can be
unsigned).
Diffstat:
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/libutil/mode.c b/libutil/mode.c
@@ -1,3 +1,4 @@
+/* See LICENSE file for copyright and license details. */
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
@@ -23,10 +24,8 @@ parsemode(const char *str, mode_t mode, mode_t mask)
octal = strtol(str, &end, 8);
if (*end == '\0') {
- if (octal < 0 || octal > 07777) {
+ if (octal < 0 || octal > 07777)
eprintf("%s: invalid mode\n", str);
- return -1;
- }
mode = 0;
if (octal & 04000) mode |= S_ISUID;
if (octal & 02000) mode |= S_ISGID;
@@ -78,7 +77,6 @@ next:
break;
default:
eprintf("%s: invalid mode\n", str);
- return -1;
}
perm = 0;
diff --git a/xinstall.c b/xinstall.c
@@ -215,11 +215,8 @@ main(int argc, char *argv[])
owner = getuid();
}
- if (mflag) {
+ if (mflag)
mode = parsemode(mflag, mode, 0);
- if (mode < 0)
- return 1;
- }
if (tflag) {
memmove(argv - 1, argv, argc);