Fix reading multiple signals from buffer on macOS

This commit is contained in:
Kovid Goyal 2022-07-10 12:07:54 +05:30
parent 3ab12c616c
commit 8358377ec3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -171,8 +171,8 @@ read_signals(int fd, handle_signal_func callback, void *data) {
bool keep_going = true;
while (keep_going && buf_pos >= sizeof(siginfo_t)) {
keep_going = callback((siginfo_t*)buf, data);
memmove(buf, buf + sizeof(siginfo_t), sizeof(siginfo_t));
buf_pos -= sizeof(siginfo_t);
memmove(buf, buf + sizeof(siginfo_t), buf_pos);
}
if (len == 0) break;
}