atexit() replacement

dronnikov at gmail.com dronnikov at gmail.com
Wed Feb 27 21:23:34 UTC 2008


Hello, List!

As you all know, many things would be simpler
if we had not "deprecated" usage of atexit().
E.g. clean exit for applets which set tty modes, and so on.

Let us look at xfunc_error_retval variable which determines
the applet exit code in case of failure of x*() functions.

It is declared as
int xfunc_error_retval = EXIT_FAILURE;

I propose to change slightly its meaning:

0. if it is less than 256 -- then still use it as exit code.
1. otherwise xfunc_die() should treat it as (*tricky_atexit)(void)
and "execute" it before calling exit().

Comments?

--
Vladimir


More information about the busybox mailing list