[CRIU] [PATCH 4/8] restore: move pid variable to local scope

Dmitry Safonov dsafonov at virtuozzo.com
Fri Jul 15 12:28:43 PDT 2016


cr-restore.c:1516:9: warning: Value stored to 'pid' during its initialization is never read
                pid_t pid = item->pid.real;
                      ^~~   ~~~~~~~~~~~~~~
cr-restore.c:1570:9: warning: Value stored to 'pid' during its initialization is never read
                pid_t pid = item->pid.real;
                      ^~~   ~~~~~~~~~~~~~~

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/cr-restore.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index b4b703880e38..77e0af99220d 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1513,7 +1513,6 @@ static int attach_to_tasks(bool root_seized)
 	struct pstree_item *item;
 
 	for_each_pstree_item(item) {
-		pid_t pid = item->pid.real;
 		int status, i;
 
 		if (!task_alive(item))
@@ -1523,7 +1522,7 @@ static int attach_to_tasks(bool root_seized)
 			return -1;
 
 		for (i = 0; i < item->nr_threads; i++) {
-			pid = item->threads[i].real;
+			pid_t pid = item->threads[i].real;
 
 			if (item != root_item || !root_seized || i != 0) {
 				if (ptrace(PTRACE_SEIZE, pid, 0, 0)) {
@@ -1567,7 +1566,6 @@ static int catch_tasks(bool root_seized, enum trace_flags *flag)
 	struct pstree_item *item;
 
 	for_each_pstree_item(item) {
-		pid_t pid = item->pid.real;
 		int status, i, ret;
 
 		if (!task_alive(item))
@@ -1577,7 +1575,7 @@ static int catch_tasks(bool root_seized, enum trace_flags *flag)
 			return -1;
 
 		for (i = 0; i < item->nr_threads; i++) {
-			pid = item->threads[i].real;
+			pid_t pid = item->threads[i].real;
 
 			if (ptrace(PTRACE_INTERRUPT, pid, 0, 0)) {
 				pr_perror("Can't interrupt the %d task", pid);
-- 
2.9.0



More information about the CRIU mailing list