Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Mar 2010 23:30:44 GMT
From:      Alexander Best <alexbestms@wwu.de>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/144749: [libstand] [patch] make assert.c use abort(3) instead of exit(3)
Message-ID:  <201003142330.o2ENUimQ065607@www.freebsd.org>
Resent-Message-ID: <201003142340.o2ENe6ug000422@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         144749
>Category:       misc
>Synopsis:       [libstand] [patch] make assert.c use abort(3) instead of exit(3)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 14 23:40:06 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Alexander Best
>Release:        9.0-CURRENT
>Organization:
>Environment:
FreeBSD otaku 9.0-CURRENT FreeBSD 9.0-CURRENT #8 r205019M: Thu Mar 11 21:03:33 CET 2010     root@otaku:/usr/obj/usr/src/sys/ARUNDEL  amd64
>Description:
gcc complaints about the use of exit() in assert.c:

/usr/src/lib/libstand/assert.c:43: warning: implicit declaration of function
'exit'

the attached patch replaces exit() (which is used illegally anyway, because no integer argument is being supplied) with abort().

assert.c uses stand.h which conflicts with stdlib.h. so this patch also defines abort() in stand.h being an external function.

cheers.
alex
>How-To-Repeat:
cd /usr/src/lib/libstand && make
>Fix:


Patch attached with submission follows:

Index: lib/libstand/assert.c
===================================================================
--- lib/libstand/assert.c	(revision 205121)
+++ lib/libstand/assert.c	(working copy)
@@ -40,5 +40,5 @@
 	else
 		printf("Assertion failed: (%s), function %s, file %s, line "
 		    "%d.\n", expression, func, file, line);
-	exit();
+	abort();
 }
Index: lib/libstand/stand.h
===================================================================
--- lib/libstand/stand.h	(revision 205121)
+++ lib/libstand/stand.h	(working copy)
@@ -265,6 +265,7 @@
 extern char	*optarg;			/* getopt(3) external variables */
 extern int	optind, opterr, optopt, optreset;
 extern int	getopt(int, char * const [], const char *);
+extern void	abort(void);
 
 /* pager.c */
 extern void	pager_open(void);


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003142330.o2ENUimQ065607>