|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] [PATCH] SIGTERM and SIGINT handler to flush xentop -b ou
On Tue, Oct 02, 2007 at 10:22:16AM +0900, INAKOSHI Hiroya wrote:
> +void a_sig_handler(int n)
> +{
> + fflush(stdout);
> + exit(0);
> +}
Neither exit() nor fflush() are guaranteed signal safe:
http://opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04_03
so can't be used in signal handlers.
> } else {
> + signal(SIGTERM, a_sig_handler);
> + signal(SIGINT, a_sig_handler);
There's never a reason to use signal() these days, even if you made the
handler use _exit()
regards
john
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|