changeset 17001:47d115143a81

maint.mk: forbid exit(-1) 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>
author Eric Blake <eblake@redhat.com>
date Fri, 20 Jul 2012 15:29:22 -0600
parents 9fc45cd5d9b5
children 0103491fe167
files ChangeLog top/maint.mk
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -353,8 +353,9 @@
 #  | 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,