kern/144749: [libstand] [patch] make assert.c use abort(3)
instead of exit(3)
Alexander Best
alexbestms at wwu.de
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 wwu.de>
To: <bug-followup at FreeBSD.org>
Cc:
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.
--+permail-20100321102753f0889e84000028d8-a_best01+
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
John Baldwin proposed the following change:
--
Alexander Best
--+permail-20100321102753f0889e84000028d8-a_best01+
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 freebsd.org>
X-Original-To: alexbestms at wwu.de
Delivered-To: a_best01 at UNI-MUENSTER.DE
Received: from zivm-relay3.uni-muenster.de (ZIVM-RELAY3.UNI-MUENSTER.DE [128.176.192.19])
by ZIVMAILSTORE1.UNI-MUENSTER.DE (Postfix) with ESMTP id E6D1D30C938
for <alexbestms at wwu.de>; 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";
d="scan'208";a="28469430"
Received: from cyrus.watson.org ([65.122.17.42])
by zivm-wwu3.uni-muenster.de with ESMTP; 15 Mar 2010 17:05:33 +0100
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69])
by cyrus.watson.org (Postfix) with ESMTPSA id 84DF546B8C;
Mon, 15 Mar 2010 12:05:31 -0400 (EDT)
Received: from zion.baldwin.cx (pool-98-109-181-99.nwrknj.fios.verizon.net [98.109.181.99])
by bigwig.baldwin.cx (Postfix) with ESMTPA id 8CEB48A021;
Mon, 15 Mar 2010 12:05:30 -0400 (EDT)
From: John Baldwin <jhb at freebsd.org>
To: freebsd-hackers at freebsd.org
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 wwu.de>
References: <permail-20100313135219f7e55a9d00006340-a_best01 at message-id.uni-muenster.de>
In-Reply-To: <permail-20100313135219f7e55a9d00006340-a_best01 at message-id.uni-muenster.de>
MIME-Version: 1.0
Content-Type: Text/Plain;
charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
Message-Id: <201003151132.18617.jhb at freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 15 Mar 2010 12:05:30 -0400 (EDT)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
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 bigwig.baldwin.cx
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);
+
void
__assert(const char *func, const char *file, int line, const char
*expression)
{
@@ -40,5 +42,5 @@
else
printf("Assertion failed: (%s), function %s, file %s, line "
"%d.\n", expression, func, file, line);
- exit();
+ exit(1);
}
--
John Baldwin
--+permail-20100321102753f0889e84000028d8-a_best01+--
More information about the freebsd-bugs
mailing list