maint.mk: forbid exit(-1)
authorEric Blake <eblake@redhat.com>
Fri, 20 Jul 2012 21:29:22 +0000 (15:29 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 20 Jul 2012 21:29:22 +0000 (15:29 -0600)
Libvirt accidentally had an 'exit (-1)' which got by the syntax
checker; generally, exiting with 255 is not a wise idea.

* top/maint.mk (sc_prohibit_magic_number_exit): Detect negatives.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
top/maint.mk

index 8f76052..2fa6fd5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-07-20  Eric Blake  <eblake@redhat.com>
+
+       maint.mk: forbid exit(-1)
+       * top/maint.mk (sc_prohibit_magic_number_exit): Detect negatives.
+
 2012-07-20  Paul Eggert  <eggert@cs.ucla.edu>
 
        fsusage: port back to Solaris
index d5af750..b39e9ae 100644 (file)
@@ -353,8 +353,9 @@ sc_prohibit_strncpy:
 #  | xargs --no-run-if-empty \
 #      perl -pi -e 's/(^|[^.])\b(exit ?)\(0\)/$1$2(EXIT_SUCCESS)/'
 sc_prohibit_magic_number_exit:
-       @prohibit='(^|[^.])\<(usage|exit) ?\([0-9]|\<error ?\([1-9][0-9]*,'     \
-       halt='use EXIT_* values rather than magic number'                       \
+       @prohibit='(^|[^.])\<(usage|exit|error) ?\(-?[0-9]+[,)]'        \
+       exclude='error ?\(0,'                                           \
+       halt='use EXIT_* values rather than magic number'               \
          $(_sc_search_regexp)
 
 # Using EXIT_SUCCESS as the first argument to error is misleading,