summaryrefslogtreecommitdiff
path: root/docs/examples
diff options
context:
space:
mode:
authorDaniel Gustafsson <daniel@yesql.se>2021-06-29 00:57:34 +0200
committerDaniel Stenberg <daniel@haxx.se>2021-08-13 23:38:28 +0200
commit39de26379527f5dc82c138b90a3ae48c20a0c03a (patch)
treecd169e7b0c8711b7a4a48186e567c7a44f7c29c6 /docs/examples
parent32f6812b5ac3649e21e28d46bfdbf96af2786347 (diff)
downloadcurl-39de26379527f5dc82c138b90a3ae48c20a0c03a.tar.gz
examples/ephiperfifo.c: simplify signal handler
The signal handler registered for SIGINT is only handling SIGINT so there isn't much need for inspecting the signo. While there, rename the handler to be more specific. g_should_exit should really be of sig_atomic_t type, but relying on autoconf in the examples seems like a bad idea so keep that for now. Reviewed-by: Daniel Stenberg Closes #7310
Diffstat (limited to 'docs/examples')
-rw-r--r--docs/examples/ephiperfifo.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/docs/examples/ephiperfifo.c b/docs/examples/ephiperfifo.c
index 11761b977..d01c99bf5 100644
--- a/docs/examples/ephiperfifo.c
+++ b/docs/examples/ephiperfifo.c
@@ -455,11 +455,9 @@ static void clean_fifo(GlobalInfo *g)
int g_should_exit_ = 0;
-void SignalHandler(int signo)
+void sigint_handler(int signo)
{
- if(signo == SIGINT) {
- g_should_exit_ = 1;
- }
+ g_should_exit_ = 1;
}
int main(int argc, char **argv)
@@ -472,7 +470,7 @@ int main(int argc, char **argv)
(void)argv;
g_should_exit_ = 0;
- signal(SIGINT, SignalHandler);
+ signal(SIGINT, sigint_handler);
memset(&g, 0, sizeof(GlobalInfo));
g.epfd = epoll_create1(EPOLL_CLOEXEC);