subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1822903 - /subversion/trunk/subversion/tests/svn_test_main.c
Date Thu, 01 Feb 2018 20:35:06 GMT
Author: julianfoad
Date: Thu Feb  1 20:35:06 2018
New Revision: 1822903

URL: http://svn.apache.org/viewvc?rev=1822903&view=rev
Log:
* subversion/tests/svn_test_main.c
  (test_main): Avoid possible undefined behaviour when skipping invalid options.

Modified:
    subversion/trunk/subversion/tests/svn_test_main.c

Modified: subversion/trunk/subversion/tests/svn_test_main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test_main.c?rev=1822903&r1=1822902&r2=1822903&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/svn_test_main.c (original)
+++ subversion/trunk/subversion/tests/svn_test_main.c Thu Feb  1 20:35:06 2018
@@ -903,9 +903,12 @@ svn_test_main(int argc, const char *argv
       apr_err = apr_getopt_long(os, cl_options, &opt_id, &opt_arg);
       if (APR_STATUS_IS_EOF(apr_err))
         break;
-      else if (apr_err && (apr_err != APR_BADCH))
+      else if (apr_err)
         {
           /* Ignore invalid option error to allow passing arbitrary options */
+          if (apr_err == APR_BADCH)
+            continue;
+
           fprintf(stderr, "apr_getopt_long failed : [%d] %s\n",
                   apr_err, apr_strerror(apr_err, errmsg, sizeof(errmsg)));
           exit(1);



Mime
View raw message