Skip to contentSkip to conversation

proc: fixup test for read

PATCH In review Alexey Dobriyan 2 participants 2 messages Mar 16, 2018

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

PATCH 1/1 proc: fixup test for read

/proc/kmsg can and will block if read under root.

---

 tools/testing/selftests/proc/read.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/proc/read.c +2 -1
@@ -54,7 +54,8 @@ static void f_reg(DIR *d, const char *filename)
 	int fd;
 	ssize_t rv;
 
-	fd = openat(dirfd(d), filename, O_RDONLY);
+	/* read from /proc/kmsg can block */
+	fd = openat(dirfd(d), filename, O_RDONLY|O_NONBLOCK);
 	if (fd == -1)
 		return;
 	rv = read(fd, buf, sizeof(buf));
#1 lore raw
Quoted 2 lines · On Sat, 17 Mar 2018 02:21:47 +0300 Alexey Dobriyan <[email protected]> wrote:

/proc/kmsg can and will block if read under root.

This fixes proc-shotgun-test-read-readdir-readlink-a-little-write.patch. It helps to point that out, so that reviewers won't be scrambling around asking wtf.