ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
* [LTP] [PATCH] setfsuid02: using -1 as invalid fsuid for setfsuid()
@ 2022-10-27 14:09 Avinesh Kumar
  2022-10-31 11:37 ` Petr Vorel
  2022-10-31 13:01 ` Richard Palethorpe
  0 siblings, 2 replies; 13+ messages in thread
From: Avinesh Kumar @ 2022-10-27 14:09 UTC (permalink / raw)
  To: ltp

a uid which does not have an entry in the /etc/passwd
file is not really an invalid fsuid for setfsuid(), so changing
the test to use -1 as an invalid fsuid.
And second setfsuid(-1) call is to verify that preceding call has
actually failed and there is no change in the fsuid.

Signed-off-by: Avinesh Kumar <akumar@suse.de>
---
 testcases/kernel/syscalls/setfsuid/setfsuid02.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/setfsuid/setfsuid02.c b/testcases/kernel/syscalls/setfsuid/setfsuid02.c
index 850f17834..f5aa1c004 100644
--- a/testcases/kernel/syscalls/setfsuid/setfsuid02.c
+++ b/testcases/kernel/syscalls/setfsuid/setfsuid02.c
@@ -21,9 +21,7 @@ static void run(void)
 	uid_t invalid_uid, current_uid;
 
 	current_uid = geteuid();
-	invalid_uid = 1;
-	while (getpwuid(invalid_uid))
-		invalid_uid++;
+	invalid_uid = -1;
 
 	UID16_CHECK(invalid_uid, setfsuid);
 
-- 
2.38.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-11-02  7:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-27 14:09 [LTP] [PATCH] setfsuid02: using -1 as invalid fsuid for setfsuid() Avinesh Kumar
2022-10-31 11:37 ` Petr Vorel
2022-10-31 13:36   ` Martin Doucha
2022-10-31 13:50     ` Petr Vorel
2022-10-31 14:00       ` Martin Doucha
2022-10-31 14:56         ` Petr Vorel
2022-10-31 17:23           ` Martin Doucha
2022-10-31 21:39             ` Petr Vorel
2022-11-02  7:40               ` Avinesh Kumar
2022-10-31 13:01 ` Richard Palethorpe
2022-10-31 21:40   ` Petr Vorel
2022-11-01  9:03     ` Richard Palethorpe
2022-11-02  7:52       ` Avinesh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).