diff mbox series

[ptest-runner,2/2] utils.c: make the pty file readable by all users

Message ID 20230321192111.197351-2-ovidiu.panait@windriver.com
State New
Headers show
Series [ptest-runner,1/2] utils.c: rework pty setup | expand

Commit Message

Ovidiu Panait March 21, 2023, 7:21 p.m. UTC
The "run-test" bash ptest expects read permissions for /dev/stdin:
test -r /dev/fd/0
test -r /dev/stdin

The test currently fails because:
- bash-ptest is run as a regular user
- the underlying device for /dev/stdin is a pty, which is owned by root

Make the pty file readable by all users to fix this ptest.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
---
 utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/utils.c b/utils.c
index 87ac20e..643693a 100644
--- a/utils.c
+++ b/utils.c
@@ -406,7 +406,7 @@  setup_slave_pty(FILE *fp, char *pty_name) {
 	}
 
 	/* Makes the slave read/writeable for the user. */
-	if (chmod(pty_name, S_IRUSR|S_IWUSR) != 0) {
+	if (chmod(pty_name, S_IRUSR|S_IWUSR|S_IROTH) != 0) {
 		fprintf(fp, "ERROR: chmod() failed with: %s.\n", strerror(errno));
 	}