1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* 3 * Copyright (c) International Business Machines Corp., 2001 4 * Copyright (c) Linux Test Project, 2009-2022 5 */ 6 7 /*\ 8 * [Description] 9 * 10 * Verify that setuid(2) returns 0 and effective uid has 11 * been set successfully as a normal or super user. 12 */ 13 14 #include <errno.h> 15 #include <unistd.h> 16 #include <sys/types.h> 17 #include "tst_test.h" 18 #include "compat_tst_16.h" 19 verify_setuid(void)20static void verify_setuid(void) 21 { 22 uid_t uid; 23 24 uid = getuid(); 25 UID16_CHECK(uid, setuid); 26 27 TST_EXP_PASS(SETUID(uid), "setuid(%d)", uid); 28 } 29 30 static struct tst_test test = { 31 .test_all = verify_setuid, 32 }; 33