[Live-devel] [Patch] Don't exit(0) but abort() in case of unhanded error.

Pierre d'Herbemont pdherbemont at free.fr
Wed Dec 30 07:08:51 PST 2009


On Wed, Dec 30, 2009 at 2:40 PM, Ross Finlayson <finlayson at live555.com> wrote:
>> Without this patch my VLC exists, pretending everything went fine.
>
>  And why do you feel that "abort()" is better than
> "exit()"?  (Because you can catch it in a signal handler?)

Because exit(0) means program exited without issue. You are pretending
to do something you don't do :-)
Also exit() may trigger atexit() and such, which can result in a crash
even less explicit.

Try abort() on your system, you'll see that it logs that it didn't
cleanly aborted, and/or even automatically create a crash report, and
backtrace on some system. (See 'man abort')

On my build system, abort() launches the debugger as well.

I think, it's pretty obvious now :-)

Feel free to change this to an assert() which would makes sense as well.

> As I noted in my earlier response (to someone else's question), this call
> (and other calls) to "exit()" should be getting called only if there's a
> serious problem in your code.  Are you actually seeing this?  If so, you
> should figure out why

Sure, I still don't know the real reason why I do get this, I have
added more debug code, and hopefully the backtrace will help me. But
for now I wasn't able to reproduce.

Pierre.


More information about the live-devel mailing list