[hackers] [sbase] parsemode: No need to return after eprintf || Michael Forney

From: <git_AT_suckless.org>
Date: Tue, 27 Dec 2016 15:04:02 +0100 (CET)

commit 87f40834a329f4f526fd17b1be36c75da0323573
Author: Michael Forney <mforney_AT_mforney.org>
AuthorDate: Wed Nov 30 23:27:59 2016 -0800
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Tue Dec 27 13:33:35 2016 +0100

    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).

diff --git a/libutil/mode.c b/libutil/mode.c
index 365b9ad..187c7a3 100644
--- a/libutil/mode.c
+++ b/libutil/mode.c
_AT_@ -1,3 +1,4 @@
+/* See LICENSE file for copyright and license details. */
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
_AT_@ -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;
_AT_@ -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
_AT_@ -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);
Received on Tue Dec 27 2016 - 15:04:02 CET

This archive was generated by hypermail 2.3.0 : Tue Dec 27 2016 - 15:13:20 CET