kern/144749: [libstand] [patch] make assert.c use abort(3) instead of exit(3)

Alexander Best alexbestms at
Sun Mar 21 10:30:09 UTC 2010

The following reply was made to PR kern/144749; it has been noted by GNATS.

From: Alexander Best <alexbestms at>
To: <bug-followup at>
Subject: Re: kern/144749: [libstand] [patch] make assert.c use abort(3)
 instead of exit(3)
Date: Sun, 21 Mar 2010 11:27:53 +0100 (CET)

   This is a MIME encoded multipart message.
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 John Baldwin proposed the following change:
 Alexander Best
 Content-Type: message/rfc822; charset=us-ascii
 Content-Description: Re: [patch] small fix to stop gcc warning for
  lib/libstand/assert.c (fwd)
 Return-Path: <jhb at>
 X-Original-To: alexbestms at
 Delivered-To: a_best01 at UNI-MUENSTER.DE
 Received: from (ZIVM-RELAY3.UNI-MUENSTER.DE [])
 	by ZIVMAILSTORE1.UNI-MUENSTER.DE (Postfix) with ESMTP id E6D1D30C938
 	for <alexbestms at>; Mon, 15 Mar 2010 17:05:33 +0100 (CET)
 X-IronPort-Anti-Spam-Filtered: true
 X-IronPort-Anti-Spam-Result: AokEAAL4nUtBehEqgWdsb2JhbACacRUBARYkIrlIhHsE
 X-IronPort-AV: E=Sophos;i="4.49,644,1262559600"; 
 Received: from ([])
   by with ESMTP; 15 Mar 2010 17:05:33 +0100
 Received: from ( [])
 	by (Postfix) with ESMTPSA id 84DF546B8C;
 	Mon, 15 Mar 2010 12:05:31 -0400 (EDT)
 Received: from ( [])
 	by (Postfix) with ESMTPA id 8CEB48A021;
 	Mon, 15 Mar 2010 12:05:30 -0400 (EDT)
 From: John Baldwin <jhb at>
 To: freebsd-hackers at
 Subject: Re: [patch] small fix to stop gcc warning for lib/libstand/assert.c
 Date: Mon, 15 Mar 2010 11:32:18 -0400
 User-Agent: KMail/1.12.4 (FreeBSD/7.3-PRERELEASE; KDE/4.3.4; i386; ; )
 Cc: Alexander Best <alexbestms at>
 References: <permail-20100313135219f7e55a9d00006340-a_best01 at>
 In-Reply-To: <permail-20100313135219f7e55a9d00006340-a_best01 at>
 MIME-Version: 1.0
 Content-Type: Text/Plain;
 Content-Transfer-Encoding: 7bit
 Message-Id: <201003151132.18617.jhb at>
 X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (; Mon, 15 Mar 2010 12:05:30 -0400 (EDT)
 X-Virus-Scanned: clamav-milter 0.95.1 at
 X-Virus-Status: Clean
 X-Spam-Status: No, score=-3.0 required=4.2 tests=AWL,BAYES_00,
 	FH_HOST_EQ_VERIZON_P,RDNS_DYNAMIC autolearn=no version=3.2.5
 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
 X-UID: 1391                                                  
 Status: RO
 Content-Length: 1360
 On Saturday 13 March 2010 08:52:19 am Alexander Best wrote:
 > hello,
 > this patch fixes the following gcc warning:
 > /usr/src/lib/libstand/assert.c:43: warning: implicit declaration of
 >  function 'exit'
 > by using abort() instead of exit() (which is illegal anyway). looking at
 > lib/libc/gen/assert.c abort() seems save to use instead of exit().
 There is no abort() in libstand or any of the boot code.  If you built a full 
 world with this change you should have gotten a link error for /boot/loader.  
 exit() is required by the boot code however (see sys/boot/common/panic.c).  
 The use of exit() instead of abort() here is on purpose.  This is the fix I 
 would use.  I would not add 'exit()' to <stand.h> as it is not an interface 
 that libstand provides, but one that it requires from the environment it is 
 linked with.
 Index: assert.c
 --- assert.c    (revision 204953)
 +++ assert.c    (working copy)
 @@ -31,6 +31,8 @@
  #include "stand.h"
 +void   exit(int);
  __assert(const char *func, const char *file, int line, const char 
 @@ -40,5 +42,5 @@
                 printf("Assertion failed: (%s), function %s, file %s, line "
                     "%d.\n", expression, func, file, line);
 -       exit();
 +       exit(1);
 John Baldwin

More information about the freebsd-bugs mailing list