/**
* handle_interrupt - Handle a signal
- *
- * Returns: %TRUE on SIGINT, SIGTERM; %FALSE on all other signals.
*/
-static int handle_interrupt(void)
+static void handle_interrupt(void)
{
switch (last_signal) {
- case SIGINT:
- case SIGTERM:
- return TRUE;
case SIGUSR1:
print_stats();
putchar('\n');
break;
+ default:
+ signal(last_signal, SIG_DFL);
+ raise(last_signal);
+ break;
}
-
last_signal = 0;
- return FALSE;
}
#ifdef USE_XATTR
// We now have two sorted tables of xattr names.
for (i = 0; i < n_a; i++) {
- if (handle_interrupt())
- goto exit; // user wants to quit
+ handle_interrupt();
if (strcmp(name_ptrs_a[i], name_ptrs_b[i]) != 0)
goto exit; // names at same slot differ
int included;
int excluded;
- if (handle_interrupt())
- return 1;
+ handle_interrupt();
if (typeflag == FTW_DNR || typeflag == FTW_NS)
warn(_("cannot read %s"), fpath);
if (typeflag != FTW_F || !S_ISREG(sb->st_mode))
size_t nnodes, memsiz;
int may_reflink = 0;
- if (handle_interrupt())
- exit(EXIT_FAILURE);
+ handle_interrupt();
if (master->links == NULL)
continue;
for (other = master->next; other != NULL; other = other->next) {
int eq;
- if (handle_interrupt())
- exit(EXIT_FAILURE);
+ handle_interrupt();
assert(other != other->next);
assert(other->st.st_size == master->st.st_size);
*/
static void sighandler(int i)
{
- UL_PROTECT_ERRNO;
- if (last_signal != SIGINT)
- last_signal = i;
- if (i == SIGINT)
- /* can't use stdio on signal handler */
- ignore_result(write(STDOUT_FILENO, "\n", sizeof("\n")-1));
+ last_signal = i;
}
int main(int argc, char *argv[])
sa.sa_flags = SA_RESTART;
sigfillset(&sa.sa_mask);
- /* If we receive a SIGINT, end the processing */
sigaction(SIGINT, &sa, NULL);
sigaction(SIGUSR1, &sa, NULL);