If parsing of a command in one of the trigger files fails, treat this as an
authortobias <tobias@openbsd.org>
Fri, 29 Aug 2008 09:46:10 +0000 (09:46 +0000)
committertobias <tobias@openbsd.org>
Fri, 29 Aug 2008 09:46:10 +0000 (09:46 +0000)
error instead of ignoring it.

ok joris

usr.bin/cvs/trigger.c

index f3c86c5..454dd78 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: trigger.c,v 1.14 2008/06/17 17:15:56 tobias Exp $     */
+/*     $OpenBSD: trigger.c,v 1.15 2008/08/29 09:46:10 tobias Exp $     */
 /*
  * Copyright (c) 2008 Tobias Stoeckmann <tobias@openbsd.org>
  * Copyright (c) 2008 Jonathan Armani <dbd@asystant.net>
@@ -288,26 +288,25 @@ cvs_trigger_handle(int type, char *repo, char *in, struct trigger_list *list,
        struct trigger_line *line;
 
        TAILQ_FOREACH(line, list, flist) {
-               cmd = parse_cmd(type, line->line, repo, files);
-               if (cmd != NULL) {
-                       switch(type) {
-                       case CVS_TRIGGER_COMMITINFO:
-                       case CVS_TRIGGER_TAGINFO:
-                       case CVS_TRIGGER_VERIFYMSG:
-                               if ((r = cvs_exec(cmd, NULL, 1)) != 0) {
-                                       xfree(cmd);
-                                       return r;
-                               }
-                               break;
-                       default:
-                               (void)cvs_exec(cmd, in, 1);
-                               break;
+               if ((cmd = parse_cmd(type, line->line, repo, files)) == NULL)
+                       return (1);
+               switch(type) {
+               case CVS_TRIGGER_COMMITINFO:
+               case CVS_TRIGGER_TAGINFO:
+               case CVS_TRIGGER_VERIFYMSG:
+                       if ((r = cvs_exec(cmd, NULL, 1)) != 0) {
+                               xfree(cmd);
+                               return (r);
                        }
-                       xfree(cmd);
+                       break;
+               default:
+                       (void)cvs_exec(cmd, in, 1);
+                       break;
                }
+               xfree(cmd);
        }
 
-       return 0;
+       return (0);
 }
 
 struct trigger_list *