Skip to contentSkip to conversation

selftests/seccomp: Fix indentation and rebase error logging patch

PATCH New Sameeksha Sankpal 1 participant 1 message Nov 27, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 selftests/seccomp: Fix indentation and rebase error logging patch

v4:
- Resending v3 after reviewer feedback (Shuah Khan).
- No code changes.
- Fixes email formatting and broken threading in earlier versions.

v3:
- Rebased against upstream seccomp tree.
- Fixed indentation to use tabs instead of spaces.
- Used scripts/checkpatch.pl to fix warnings.
- Removed blank line before Signed-off-by.

v2:
- Used TH_LOG instead of printf for error logging.
- Moved variable declaration to the top of the function.
- Applied review suggestions from Kees Cook.

v1:
- Initial patch to improve error logging in get_proc_stat().

---
 tools/testing/selftests/seccomp/seccomp_bpf.c | 5 +++++
 1 file changed, 5 insertions(+)
tools/testing/selftests/seccomp/seccomp_bpf.c +5 -0
index 61acbd45ffaa..dbd7e705a2af 100644
@@ -4508,9 +4508,14 @@ static char get_proc_stat(struct __test_metadata *_metadata, pid_t pid)
 	char proc_path[100] = {0};
 	char status;
 	char *line;
+	int rc;
 
 	snprintf(proc_path, sizeof(proc_path), "/proc/%d/stat", pid);
 	ASSERT_EQ(get_nth(_metadata, proc_path, 3, &line), 1);
+	rc = get_nth(_metadata, proc_path, 3, &line);
+	ASSERT_EQ(rc, 1) {
+		TH_LOG("user_notification_fifo: failed to read stat for PID %d (rc=%d)", pid, rc);
+	}
 
 	status = *line;
 	free(line);
Signature · 1 line
2.43.0