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).
---
 libutil/mode.c | 6 ++----
 xinstall.c     | 5 +----
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/libutil/mode.c b/libutil/mode.c
index 365b9ad..187c7a3 100644
--- 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
index bf921fb..70d7097 100644
--- 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);
-- 
2.10.2


Reply via email to