r14751: Use the noreturn attribute to try and tell coverity that
authorJeremy Allison <jra@samba.org>
Tue, 28 Mar 2006 15:50:13 +0000 (15:50 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:15:45 +0000 (11:15 -0500)
smb_panic can't return.
Jeremy.

source/include/includes.h
source/lib/util.c

index 9f6f8b2471841e1b64183f01823c57c93f361b7c..e02a981d56ae607637cdae8aac71dc3365a0fba6 100644 (file)
@@ -1553,4 +1553,13 @@ LDAP *ldap_open_with_timeout(const char *server, int port, unsigned int to);
 #define CONST_DISCARD(type, ptr)      ((type) ((void *) (ptr)))
 #define CONST_ADD(type, ptr)          ((type) ((const void *) (ptr)))
 
+#ifndef NORETURN_ATTRIBUTE
+#if (__GNUC__ >= 3)
+#define NORETURN_ATTRIBUTE __attribute__ ((noreturn))
+#else
+#define NORETURN_ATTRIBUTE
+#endif
+#endif
+
+void smb_panic( const char *why ) NORETURN_ATTRIBUTE ;
 #endif /* _INCLUDES_H */
index 5bf9409c2fa7892bcbf762c2ccea68de6131e279..0b831ea335bc0852cf5768b7137ac967d75fad28 100644 (file)
@@ -1541,14 +1541,6 @@ gid_t nametogid(const char *name)
        return (gid_t)-1;
 }
 
-/*******************************************************************
- legacy wrapper for smb_panic2()
-********************************************************************/
-void smb_panic( const char *why )
-{
-       smb_panic2( why, True );
-}
-
 /*******************************************************************
  Something really nasty happened - panic !
 ********************************************************************/
@@ -1557,7 +1549,7 @@ void smb_panic( const char *why )
 #include <libexc.h>
 #endif
 
-void smb_panic2(const char *why, BOOL decrement_pid_count )
+static void smb_panic2(const char *why, BOOL decrement_pid_count )
 {
        char *cmd;
        int result;
@@ -1663,6 +1655,17 @@ void smb_panic2(const char *why, BOOL decrement_pid_count )
        abort();
 }
 
+/*******************************************************************
+ wrapper for smb_panic2()
+********************************************************************/
+
+ void smb_panic( const char *why )
+{
+       smb_panic2( why, True );
+       /* Notreached. */
+       abort();
+}
+
 /*******************************************************************
   A readdir wrapper which just returns the file name.
  ********************************************************************/