[Devel] [PATCH vz10 13/15] selftests/prctl: remove unused variable 'j' in set-process-name

Konstantin Khorenko khorenko at virtuozzo.com
Mon Mar 23 23:31:32 MSK 2026


  set-process-name.c: In function 'check_name':
  set-process-name.c:61:13: warning: variable 'j' set but not used [-Wunused-but-set-variable]
     61 |         int j;
        |             ^

Remove unused 'j' to fix -Wunused-but-set-variable warning.
The snprintf() return value is not needed here.

https://virtuozzo.atlassian.net/browse/VSTOR-127529
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>

Feature: fix selftests
---
 tools/testing/selftests/prctl/set-process-name.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/testing/selftests/prctl/set-process-name.c b/tools/testing/selftests/prctl/set-process-name.c
index 562f707ba771..27468cb86a39 100644
--- a/tools/testing/selftests/prctl/set-process-name.c
+++ b/tools/testing/selftests/prctl/set-process-name.c
@@ -58,9 +58,8 @@ int check_name(void)
 	char path[MAX_PATH_LEN] = {};
 	char name[TASK_COMM_LEN] = {};
 	char output[TASK_COMM_LEN] = {};
-	int j;
 
-	j = snprintf(path, MAX_PATH_LEN, "/proc/self/task/%d/comm", pid);
+	snprintf(path, MAX_PATH_LEN, "/proc/self/task/%d/comm", pid);
 	fptr = fopen(path, "r");
 	if (!fptr)
 		return -EIO;
-- 
2.47.1



More information about the Devel mailing list