Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix signal handler #245

Closed
elfring opened this issue Feb 26, 2014 · 3 comments
Closed

Fix signal handler #245

elfring opened this issue Feb 26, 2014 · 3 comments

Comments

@elfring
Copy link

elfring commented Feb 26, 2014

The functions "endwin" and "exit" do not belong to the list of async-signal-safe functions.
I guess that a different program design will be needed for your function "quit".

@jonas
Copy link
Owner

jonas commented Feb 26, 2014

Thank you for reporting this. I suggest to instead register endwin so it is
called via atexit(3) instead. This makes it possible to remove die_callback
which does the same thing.
On Feb 26, 2014 10:22 AM, "Markus Elfring" notifications@github.com wrote:

The functions "endwinhttp://pubs.opengroup.org/onlinepubs/007908775/xcurses/endwin.html"
and "exithttp://pubs.opengroup.org/onlinepubs/9699919799/functions/exit.html"
do not belong to the list of async-signal-safe functionshttps://www.securecoding.cert.org/confluence/display/seccode/SIG30-C.+Call+only+asynchronous-safe+functions+within+signal+handlers
.
I guess that a different program design will be needed for your function "
quithttps://github.com/jonas/tig/blob/82fe0808a8e8e1a18201bc28b0aa58833fb84fcd/src/tig.c#L457
".


Reply to this email directly or view it on GitHubhttps://github.com//issues/245
.

jonas added a commit that referenced this issue Feb 26, 2014
This ensures that only asynchronous-safe functions are called within the
signal handler. In addition, it cleans up tig's shutdown mechanism so that
done_display (and endwin) is called via an atexit(3) handler.
@jonas
Copy link
Owner

jonas commented Feb 26, 2014

Something like that.

@jonas jonas closed this as completed in efbbe84 Feb 27, 2014
@elfring
Copy link
Author

elfring commented Feb 27, 2014

Thanks for your source code improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants