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

Indexes created Thu Nov 07 10:32:03 CST 2024