forked from miekg/rdup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
signal.c
41 lines (37 loc) · 789 Bytes
/
signal.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* Copyright (c) 2005 - 2011 Miek Gieben
* See LICENSE for the license
*/
#include "rdup.h"
extern int sig;
void
got_sig(int signal)
{
sig = signal;
}
/**
* we received a signal
*/
void
signal_abort(int signal)
{
int status;
switch(signal) {
case SIGPIPE:
msg(_("SIGPIPE received, exiting"));
break;
case SIGINT:
msg(_("SIGINT received, exiting"));
break;
case SIGCHLD:
(void)wait(&status);
#ifdef DEBUG
msg("Wait stat: %d\n", status);
#endif /* DEBUG */
return;
default:
msg(_("Unhandled signal reveived, exiting"));
break;
}
exit(EXIT_FAILURE);
}