Skip to content

Instantly share code, notes, and snippets.

@ayosec
Last active February 26, 2024 16:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayosec/0e7137aa0fbea7d1e42874ae86a9dc5c to your computer and use it in GitHub Desktop.
Save ayosec/0e7137aa0fbea7d1e42874ae86a9dc5c to your computer and use it in GitHub Desktop.
/* From the 'musl-tools' package:
*
* $ musl-gcc -Wall -Os -static -o test test.c
*/
#include <signal.h>
#include <sys/wait.h>
#include <unistd.h>
void nothing(int signum) {}
void term(int signum) {
_exit(0);
}
int main() {
signal(SIGCHLD, nothing);
signal(SIGTERM, term);
signal(SIGINT, term);
while(1) {
pause();
while(wait(NULL) != -1);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment