[LTP] [COMMITTED] [PATCH 39/40] syscalls/open08: Make use of SAFE_SETGID()
Cyril Hrubis
chrubis@suse.cz
Tue Oct 3 16:20:12 CEST 2017
Coccinelle haven't caught this one because of the else branch.
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
testcases/kernel/syscalls/open/open08.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/testcases/kernel/syscalls/open/open08.c b/testcases/kernel/syscalls/open/open08.c
index 742771eef..6d1f37de0 100644
--- a/testcases/kernel/syscalls/open/open08.c
+++ b/testcases/kernel/syscalls/open/open08.c
@@ -141,10 +141,8 @@ static void setup(void)
/* Switch to nobody user for correct error code collection */
ltpuser = getpwnam(nobody_uid);
- if (setgid(ltpuser->pw_gid) == -1) {
- tst_brkm(TBROK | TERRNO, NULL, "setgid(%d) failed",
- ltpuser->pw_gid);
- } else SAFE_SETUID(NULL, ltpuser->pw_uid);
+ SAFE_SETGID(NULL, ltpuser->pw_gid);
+ SAFE_SETUID(NULL, ltpuser->pw_uid);
tst_tmpdir();
--
2.13.5
More information about the ltp
mailing list