2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +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:
Pavel Emelyanov
2014-08-19 15:09:56 +04:00
parent 22082b0e55
commit 8197bae072

View File

@@ -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) {