Remove meanwhile redundant error output of apps/opt_next(void) parsing numbers
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Tue, 26 May 2020 08:44:10 +0000 (10:44 +0200)
committerDr. David von Oheimb <David.von.Oheimb@siemens.com>
Sat, 13 Jun 2020 13:13:21 +0000 (15:13 +0200)
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11998)

apps/lib/opt.c

index 566de8ab7d273a7f7ba0fc441877afc4e38b8d55..7630d516ca71a58f8f20156e62099960dbd07fb0 100644 (file)
@@ -740,40 +740,29 @@ int opt_next(void)
             break;
         case 'p':
         case 'n':
             break;
         case 'p':
         case 'n':
-            if (!opt_int(arg, &ival)
-                    || (o->valtype == 'p' && ival <= 0)) {
+            if (!opt_int(arg, &ival))
+                return -1;
+            if (o->valtype == 'p' && ival <= 0) {
                 opt_printf_stderr("%s: Non-positive number \"%s\" for -%s\n",
                                   prog, arg, o->name);
                 return -1;
             }
             break;
         case 'M':
                 opt_printf_stderr("%s: Non-positive number \"%s\" for -%s\n",
                                   prog, arg, o->name);
                 return -1;
             }
             break;
         case 'M':
-            if (!opt_imax(arg, &imval)) {
-                opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n",
-                                  prog, arg, o->name);
+            if (!opt_imax(arg, &imval))
                 return -1;
                 return -1;
-            }
             break;
         case 'U':
             break;
         case 'U':
-            if (!opt_umax(arg, &umval)) {
-                opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n",
-                                  prog, arg, o->name);
+            if (!opt_umax(arg, &umval))
                 return -1;
                 return -1;
-            }
             break;
         case 'l':
             break;
         case 'l':
-            if (!opt_long(arg, &lval)) {
-                opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n",
-                                  prog, arg, o->name);
+            if (!opt_long(arg, &lval))
                 return -1;
                 return -1;
-            }
             break;
         case 'u':
             break;
         case 'u':
-            if (!opt_ulong(arg, &ulval)) {
-                opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n",
-                                  prog, arg, o->name);
+            if (!opt_ulong(arg, &ulval))
                 return -1;
                 return -1;
-            }
             break;
         case 'c':
         case 'E':
             break;
         case 'c':
         case 'E':