mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-17 16:47:50 +00:00
signals: Move nr variable into peeking loop
And sanitize its usage a little bit. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
22082b0e55
commit
8197bae072
1 changed files with 7 additions and 7 deletions
14
cr-dump.c
14
cr-dump.c
|
|
@ -1161,7 +1161,7 @@ static int dump_signal_queue(pid_t tid, SignalQueueEntry **sqe, bool group)
|
|||
{
|
||||
struct ptrace_peeksiginfo_args arg;
|
||||
siginfo_t siginfo[32]; /* One page or all non-rt signals */
|
||||
int ret, j, nr;
|
||||
int ret, j;
|
||||
SignalQueueEntry *queue = NULL;
|
||||
|
||||
pr_debug("Dump %s signals of %d\n", group ? "shared" : "private", tid);
|
||||
|
|
@ -1179,7 +1179,12 @@ static int dump_signal_queue(pid_t tid, SignalQueueEntry **sqe, bool group)
|
|||
signal_queue_entry__init(queue);
|
||||
|
||||
for (; ; ) {
|
||||
ret = ptrace(PTRACE_PEEKSIGINFO, tid, &arg, siginfo);
|
||||
int nr;
|
||||
|
||||
nr = ret = ptrace(PTRACE_PEEKSIGINFO, tid, &arg, siginfo);
|
||||
if (ret == 0)
|
||||
break;
|
||||
|
||||
if (ret < 0) {
|
||||
if (errno == EIO) {
|
||||
pr_warn("ptrace doesn't support PTRACE_PEEKSIGINFO\n");
|
||||
|
|
@ -1189,11 +1194,6 @@ static int dump_signal_queue(pid_t tid, SignalQueueEntry **sqe, bool group)
|
|||
break;
|
||||
}
|
||||
|
||||
if (ret == 0)
|
||||
break;
|
||||
|
||||
nr = ret;
|
||||
|
||||
queue->n_signals += nr;
|
||||
queue->signals = xrealloc(queue->signals, sizeof(*queue->signals) * queue->n_signals);
|
||||
if (!queue->signals) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue