xref: /aosp_15_r20/external/ltp/testcases/kernel/syscalls/setgid/setgid01.c (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
4  *
5  * AUTHOR		: William Roske
6  * CO-PILOT		: Dave Fenner
7  */
8 /*\
9  * [Description]
10  *
11  * Calls setgid() with current gid and expects success.
12  */
13 
14 #include "tst_test.h"
15 #include "compat_tst_16.h"
16 
17 static gid_t gid;
18 
run(void)19 static void run(void)
20 {
21 	TST_EXP_PASS(SETGID(gid));
22 }
23 
setup(void)24 static void setup(void)
25 {
26 	gid = getgid();
27 	GID16_CHECK(gid, setgid);
28 }
29 
30 static struct tst_test test = {
31 	.test_all = run,
32 	.setup = setup,
33 };
34