From: Lennart Poettering Date: Thu, 8 Jul 2021 08:38:09 +0000 (+0200) Subject: copy: port over to pop_pending_signal() X-Git-Tag: v250-rc1~972^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F20168%2Fhead;p=thirdparty%2Fsystemd.git copy: port over to pop_pending_signal() --- diff --git a/src/shared/copy.c b/src/shared/copy.c index 04f99a2d6f8..65d75a15d54 100644 --- a/src/shared/copy.c +++ b/src/shared/copy.c @@ -24,6 +24,7 @@ #include "nulstr-util.h" #include "rm-rf.h" #include "selinux-util.h" +#include "signal-util.h" #include "stat-util.h" #include "stdio-util.h" #include "string-util.h" @@ -87,22 +88,6 @@ static int fd_is_nonblock_pipe(int fd) { return FLAGS_SET(flags, O_NONBLOCK) ? FD_IS_NONBLOCKING_PIPE : FD_IS_BLOCKING_PIPE; } -static int sigint_pending(void) { - sigset_t ss; - - assert_se(sigemptyset(&ss) >= 0); - assert_se(sigaddset(&ss, SIGINT) >= 0); - - if (sigtimedwait(&ss, NULL, &(struct timespec) { 0, 0 }) < 0) { - if (errno == EAGAIN) - return false; - - return -errno; - } - - return true; -} - int copy_bytes_full( int fdf, int fdt, uint64_t max_bytes, @@ -192,7 +177,7 @@ int copy_bytes_full( return 1; /* return > 0 if we hit the max_bytes limit */ if (FLAGS_SET(copy_flags, COPY_SIGINT)) { - r = sigint_pending(); + r = pop_pending_signal(SIGINT); if (r < 0) return r; if (r > 0) @@ -861,7 +846,7 @@ static int fd_copy_directory( continue; if (FLAGS_SET(copy_flags, COPY_SIGINT)) { - r = sigint_pending(); + r = pop_pending_signal(SIGINT); if (r < 0) return r; if (r > 0)