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

Alexander Best alexbestms at wwu.de
Sun Mar 14 23:40:07 UTC 2010

>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
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 14 23:40:06 UTC 2010
>Originator:     Alexander Best
>Release:        9.0-CURRENT
FreeBSD otaku 9.0-CURRENT FreeBSD 9.0-CURRENT #8 r205019M: Thu Mar 11 21:03:33 CET 2010     root at otaku:/usr/obj/usr/src/sys/ARUNDEL  amd64
gcc complaints about the use of exit() in assert.c:

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

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.

cd /usr/src/lib/libstand && make

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 @@
 		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);


More information about the freebsd-bugs mailing list