Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-3]: src/sbin/veriexecctl Pull up revision 1.16 (requested by elad...



details:   https://anonhg.NetBSD.org/src/rev/565efecdc095
branches:  netbsd-3
changeset: 576356:565efecdc095
user:      tron <tron%NetBSD.org@localhost>
date:      Sat Jul 02 15:46:26 2005 +0000

description:
Pull up revision 1.16 (requested by elad in ticket #487):
Some refactoring and bugfixes:
- Report line numbers correctly.
- Don't perform a 2nd pass when there are were errors during 1st.
- Support multiple, comma-separated flags. This is mostly a reworking of
some parser internals preparing for planned features.

diffstat:

 sbin/veriexecctl/veriexecctl.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (60 lines):

diff -r 06f946e3f0c0 -r 565efecdc095 sbin/veriexecctl/veriexecctl.c
--- a/sbin/veriexecctl/veriexecctl.c    Sat Jul 02 15:46:19 2005 +0000
+++ b/sbin/veriexecctl/veriexecctl.c    Sat Jul 02 15:46:26 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: veriexecctl.c,v 1.5.6.10 2005/06/10 15:43:25 tron Exp $        */
+/*     $NetBSD: veriexecctl.c,v 1.5.6.11 2005/07/02 15:46:26 tron Exp $        */
 
 /*-
  * Copyright 2005 Elad Efrat <elad%bsd.org.il@localhost>
@@ -49,6 +49,7 @@
 
 extern struct veriexec_params params; /* in veriexecctl_parse.y */
 extern char *filename; /* in veriexecctl_conf.l */
+extern int yynerrs;
 int gfd, verbose = 0, phase;
 size_t line;
 
@@ -60,7 +61,6 @@
 static int fingerprint_load(char*);
 static void usage(void) __attribute__((__noreturn__));
 
-
 static FILE *
 openlock(const char *path)
 {
@@ -149,6 +149,7 @@
 fingerprint_load(char *ifile)
 {
        CIRCLEQ_INIT(&params_list);
+       memset(&params, 0, sizeof(params));
 
        if ((yyin = openlock(ifile)) == NULL)
                err(1, "Cannot open `%s'", ifile);
@@ -165,7 +166,10 @@
                (void)printf("=> Parsing \"%s\"\n", ifile);
        }
 
+       line = 1;
        yyparse();
+       if (yynerrs)
+               return -1;
 
        phase1_preload();
 
@@ -182,6 +186,7 @@
                (void)printf("=> Parsing \"%s\"\n", ifile);
        }
 
+       line = 1;
        yyparse();
 
        (void)fclose(yyin);
@@ -224,7 +229,6 @@
         * Handle the different commands we can do.
         */
        if (argc == 2 && strcasecmp(argv[0], "load") == 0) {
-               line = 0;
                filename = argv[1];
                fingerprint_load(argv[1]);
        } else



Home | Main Index | Thread Index | Old Index