Print this page
11462 enable smatch by default

@@ -11,10 +11,12 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt
+ *
+ * Copyright 2019 Joyent, Inc.
  */
 
 #include <stdio.h>
 #include <unistd.h>
 #include <libgen.h>

@@ -41,10 +43,11 @@
 int option_time;
 int option_mem;
 char *option_datadir_str;
 int option_fatal_checks;
 int option_succeed;
+int option_timeout = 60;
 
 FILE *sm_outfd;
 FILE *sql_outfd;
 FILE *caller_info_fd;
 

@@ -171,11 +174,11 @@
         free(str);
         return ret;
 }
 
 #define OPTION(_x) do {                                 \
-        if (match_option((*argvp)[1], #_x)) {           \
+        if (match_option((*argvp)[i], #_x)) {           \
                 option_##_x = 1;                        \
         }                                               \
 } while (0)
 
 void parse_args(int *argcp, char ***argvp)

@@ -216,10 +219,16 @@
                         enable_disable_checks((*argvp)[i] + 10, 0);
                         option_enable = 1;
                         option_disable = 1;
                 }
 
+                if (!strncmp((*argvp)[i], "--timeout=", 10)) {
+                        if (sscanf((*argvp)[i] + 10, "%d",
+                            &option_timeout) != 1)
+                                sm_fatal("invalid option %s", (*argvp)[i]);
+                }
+
                 OPTION(fatal_checks);
                 OPTION(spammy);
                 OPTION(info);
                 OPTION(debug);
                 OPTION(debug_implied);