bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] maint.mk: forbid exit(-1)


From: Eric Blake
Subject: [PATCH] maint.mk: forbid exit(-1)
Date: Fri, 20 Jul 2012 15:32:36 -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 <address@hidden>
---
 ChangeLog    |    5 +++++
 top/maint.mk |    5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8f76052..2fa6fd5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-07-20  Eric Blake  <address@hidden>
+
+       maint.mk: forbid exit(-1)
+       * top/maint.mk (sc_prohibit_magic_number_exit): Detect negatives.
+
 2012-07-20  Paul Eggert  <address@hidden>

        fsusage: port back to Solaris
diff --git a/top/maint.mk b/top/maint.mk
index d5af750..b39e9ae 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -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,
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]