Fix issue when running fcntl31 and fcntl31_64 over SSH as session leader
PATCH 1/1 Fix issue when running fcntl31 and fcntl31_64 over SSH as session leader
If you run the test like this:
ssh localhost path/to/fcntl31
It will fail like this:
TBROK : fcntl31.c:121: setpgrp() failed: errno=EPERM(1): Operation not permitted
As man page for setpgrp says, it is indeed not permitted to change process group ID when you are session leader (PID == SID).
Signed-off-by Yann Sionneau <[email protected]>
--- testcases/kernel/syscalls/fcntl/fcntl31.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/fcntl/fcntl31.c +6 -3
@@ -116,9 +116,12 @@ static void setup(void) pid =getpid (); - ret =setpgrp (); -if (ret <0 ) -tst_brkm (TBROK |TERRNO , cleanup,"setpgrp() failed" ); +/* Changing process group ID is forbidden when PID == SID i.e. we are session leader */ +if (pid !=getsid (0 )) { + ret =setpgrp (); +if (ret <0 ) +tst_brkm (TBROK |TERRNO , cleanup,"setpgrp() failed" ); + } pgrp_pid =getpgid (0 );if (pgrp_pid <0 )tst_brkm (TBROK |TERRNO , cleanup,"getpgid() failed" );
Signature · 1 line
2.17.1
PATCH 1/1 Fix issue when running fcntl31 and fcntl31_64 over SSH as session leader
Hi!
Applied, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]