mirror of
https://github.com/systemd/systemd.git
synced 2025-02-21 05:57:34 +03:00
copy: port over to pop_pending_signal()
This commit is contained in:
parent
0178ff292b
commit
215b64b2ad
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user