Last active
February 26, 2024 16:28
-
-
Save ayosec/0e7137aa0fbea7d1e42874ae86a9dc5c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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