lkml.org 
[lkml]   [2018]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH -mm] proc: fixup test for read
/proc/kmsg can and will block if read under root.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

tools/testing/selftests/proc/read.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--- a/tools/testing/selftests/proc/read.c
+++ b/tools/testing/selftests/proc/read.c
@@ -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));
\
 
 \ /
  Last update: 2018-03-17 00:22    [W:0.041 / U:0.844 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site