1*49cdfc7eSAndroid Build Coastguard Worker /*
2*49cdfc7eSAndroid Build Coastguard Worker *
3*49cdfc7eSAndroid Build Coastguard Worker * Copyright (c) International Business Machines Corp., 2001
4*49cdfc7eSAndroid Build Coastguard Worker *
5*49cdfc7eSAndroid Build Coastguard Worker * This program is free software; you can redistribute it and/or modify
6*49cdfc7eSAndroid Build Coastguard Worker * it under the terms of the GNU General Public License as published by
7*49cdfc7eSAndroid Build Coastguard Worker * the Free Software Foundation; either version 2 of the License, or
8*49cdfc7eSAndroid Build Coastguard Worker * (at your option) any later version.
9*49cdfc7eSAndroid Build Coastguard Worker *
10*49cdfc7eSAndroid Build Coastguard Worker * This program is distributed in the hope that it will be useful,
11*49cdfc7eSAndroid Build Coastguard Worker * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*49cdfc7eSAndroid Build Coastguard Worker * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
13*49cdfc7eSAndroid Build Coastguard Worker * the GNU General Public License for more details.
14*49cdfc7eSAndroid Build Coastguard Worker *
15*49cdfc7eSAndroid Build Coastguard Worker * You should have received a copy of the GNU General Public License
16*49cdfc7eSAndroid Build Coastguard Worker * along with this program; if not, write to the Free Software
17*49cdfc7eSAndroid Build Coastguard Worker * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*49cdfc7eSAndroid Build Coastguard Worker */
19*49cdfc7eSAndroid Build Coastguard Worker
20*49cdfc7eSAndroid Build Coastguard Worker /*
21*49cdfc7eSAndroid Build Coastguard Worker * Test Name: mknod08
22*49cdfc7eSAndroid Build Coastguard Worker *
23*49cdfc7eSAndroid Build Coastguard Worker * Test Description:
24*49cdfc7eSAndroid Build Coastguard Worker * Verify that mknod(2) succeeds when used to create a filesystem
25*49cdfc7eSAndroid Build Coastguard Worker * node on a directory without set group-ID bit set. The node created
26*49cdfc7eSAndroid Build Coastguard Worker * should not have set group-ID bit set and its gid should be equal to that
27*49cdfc7eSAndroid Build Coastguard Worker * of its parent directory.
28*49cdfc7eSAndroid Build Coastguard Worker *
29*49cdfc7eSAndroid Build Coastguard Worker * Expected Result:
30*49cdfc7eSAndroid Build Coastguard Worker * mknod() should return value 0 on success and node created should not
31*49cdfc7eSAndroid Build Coastguard Worker * have set group-ID bit set.
32*49cdfc7eSAndroid Build Coastguard Worker *
33*49cdfc7eSAndroid Build Coastguard Worker * Algorithm:
34*49cdfc7eSAndroid Build Coastguard Worker * Setup:
35*49cdfc7eSAndroid Build Coastguard Worker * Setup signal handling.
36*49cdfc7eSAndroid Build Coastguard Worker * Create temporary directory.
37*49cdfc7eSAndroid Build Coastguard Worker * Pause for SIGUSR1 if option specified.
38*49cdfc7eSAndroid Build Coastguard Worker *
39*49cdfc7eSAndroid Build Coastguard Worker * Test:
40*49cdfc7eSAndroid Build Coastguard Worker * Loop if the proper options are given.
41*49cdfc7eSAndroid Build Coastguard Worker * Execute system call
42*49cdfc7eSAndroid Build Coastguard Worker * Check return code, if system call failed (return=-1)
43*49cdfc7eSAndroid Build Coastguard Worker * Log the errno and Issue a FAIL message.
44*49cdfc7eSAndroid Build Coastguard Worker * Otherwise,
45*49cdfc7eSAndroid Build Coastguard Worker * Verify the Functionality of system call
46*49cdfc7eSAndroid Build Coastguard Worker * if successful,
47*49cdfc7eSAndroid Build Coastguard Worker * Issue Functionality-Pass message.
48*49cdfc7eSAndroid Build Coastguard Worker * Otherwise,
49*49cdfc7eSAndroid Build Coastguard Worker * Issue Functionality-Fail message.
50*49cdfc7eSAndroid Build Coastguard Worker * Cleanup:
51*49cdfc7eSAndroid Build Coastguard Worker * Print errno log and/or timing stats if options given
52*49cdfc7eSAndroid Build Coastguard Worker * Delete the temporary directory created.
53*49cdfc7eSAndroid Build Coastguard Worker *
54*49cdfc7eSAndroid Build Coastguard Worker * Usage: <for command-line>
55*49cdfc7eSAndroid Build Coastguard Worker * mknod08 [-c n] [-e] [-f] [-i n] [-I x] [-P x] [-t]
56*49cdfc7eSAndroid Build Coastguard Worker * where, -c n : Run n copies concurrently.
57*49cdfc7eSAndroid Build Coastguard Worker * -e : Turn on errno logging.
58*49cdfc7eSAndroid Build Coastguard Worker * -f : Turn off functionality Testing.
59*49cdfc7eSAndroid Build Coastguard Worker * -i n : Execute test n times.
60*49cdfc7eSAndroid Build Coastguard Worker * -I x : Execute test for x seconds.
61*49cdfc7eSAndroid Build Coastguard Worker * -P x : Pause for x seconds between iterations.
62*49cdfc7eSAndroid Build Coastguard Worker * -t : Turn on syscall timing.
63*49cdfc7eSAndroid Build Coastguard Worker *
64*49cdfc7eSAndroid Build Coastguard Worker * HISTORY
65*49cdfc7eSAndroid Build Coastguard Worker * 07/2001 Ported by Wayne Boyer
66*49cdfc7eSAndroid Build Coastguard Worker *
67*49cdfc7eSAndroid Build Coastguard Worker * RESTRICTIONS:
68*49cdfc7eSAndroid Build Coastguard Worker * This test should be run by 'super-user' (root) only.
69*49cdfc7eSAndroid Build Coastguard Worker *
70*49cdfc7eSAndroid Build Coastguard Worker */
71*49cdfc7eSAndroid Build Coastguard Worker
72*49cdfc7eSAndroid Build Coastguard Worker #include <stdio.h>
73*49cdfc7eSAndroid Build Coastguard Worker #include <stdlib.h>
74*49cdfc7eSAndroid Build Coastguard Worker #include <unistd.h>
75*49cdfc7eSAndroid Build Coastguard Worker #include <errno.h>
76*49cdfc7eSAndroid Build Coastguard Worker #include <string.h>
77*49cdfc7eSAndroid Build Coastguard Worker #include <signal.h>
78*49cdfc7eSAndroid Build Coastguard Worker #include <pwd.h>
79*49cdfc7eSAndroid Build Coastguard Worker #include <sys/types.h>
80*49cdfc7eSAndroid Build Coastguard Worker #include <sys/stat.h>
81*49cdfc7eSAndroid Build Coastguard Worker
82*49cdfc7eSAndroid Build Coastguard Worker #include "test.h"
83*49cdfc7eSAndroid Build Coastguard Worker #include "safe_macros.h"
84*49cdfc7eSAndroid Build Coastguard Worker
85*49cdfc7eSAndroid Build Coastguard Worker #define LTPUSER "nobody"
86*49cdfc7eSAndroid Build Coastguard Worker #define MODE_RWX S_IFIFO | S_IRWXU | S_IRWXG | S_IRWXO
87*49cdfc7eSAndroid Build Coastguard Worker #define DIR_TEMP "testdir_1"
88*49cdfc7eSAndroid Build Coastguard Worker #define TNODE "tnode_%d"
89*49cdfc7eSAndroid Build Coastguard Worker
90*49cdfc7eSAndroid Build Coastguard Worker struct stat buf; /* struct. to hold stat(2) o/p contents */
91*49cdfc7eSAndroid Build Coastguard Worker struct passwd *user1; /* struct. to hold getpwnam(3) o/p contents */
92*49cdfc7eSAndroid Build Coastguard Worker
93*49cdfc7eSAndroid Build Coastguard Worker char *TCID = "mknod08";
94*49cdfc7eSAndroid Build Coastguard Worker int TST_TOTAL = 1;
95*49cdfc7eSAndroid Build Coastguard Worker char node_name[PATH_MAX]; /* buffer to hold node name created */
96*49cdfc7eSAndroid Build Coastguard Worker
97*49cdfc7eSAndroid Build Coastguard Worker gid_t group1_gid, group2_gid, mygid; /* user and process group id's */
98*49cdfc7eSAndroid Build Coastguard Worker uid_t save_myuid, user1_uid; /* user and process user id's */
99*49cdfc7eSAndroid Build Coastguard Worker pid_t mypid; /* process id */
100*49cdfc7eSAndroid Build Coastguard Worker
101*49cdfc7eSAndroid Build Coastguard Worker void setup(); /* setup function for the test */
102*49cdfc7eSAndroid Build Coastguard Worker void cleanup(); /* cleanup function for the test */
103*49cdfc7eSAndroid Build Coastguard Worker
main(int ac,char ** av)104*49cdfc7eSAndroid Build Coastguard Worker int main(int ac, char **av)
105*49cdfc7eSAndroid Build Coastguard Worker {
106*49cdfc7eSAndroid Build Coastguard Worker int lc;
107*49cdfc7eSAndroid Build Coastguard Worker int fflag;
108*49cdfc7eSAndroid Build Coastguard Worker
109*49cdfc7eSAndroid Build Coastguard Worker tst_parse_opts(ac, av, NULL, NULL);
110*49cdfc7eSAndroid Build Coastguard Worker
111*49cdfc7eSAndroid Build Coastguard Worker setup();
112*49cdfc7eSAndroid Build Coastguard Worker
113*49cdfc7eSAndroid Build Coastguard Worker for (lc = 0; TEST_LOOPING(lc); lc++) {
114*49cdfc7eSAndroid Build Coastguard Worker
115*49cdfc7eSAndroid Build Coastguard Worker tst_count = 0;
116*49cdfc7eSAndroid Build Coastguard Worker
117*49cdfc7eSAndroid Build Coastguard Worker /*
118*49cdfc7eSAndroid Build Coastguard Worker * Call mknod() to creat a node on a directory without
119*49cdfc7eSAndroid Build Coastguard Worker * set group-ID (sgid) bit set.
120*49cdfc7eSAndroid Build Coastguard Worker */
121*49cdfc7eSAndroid Build Coastguard Worker TEST(mknod(node_name, MODE_RWX, 0));
122*49cdfc7eSAndroid Build Coastguard Worker
123*49cdfc7eSAndroid Build Coastguard Worker /* Check return code from mknod(2) */
124*49cdfc7eSAndroid Build Coastguard Worker if (TEST_RETURN == -1) {
125*49cdfc7eSAndroid Build Coastguard Worker tst_resm(TFAIL,
126*49cdfc7eSAndroid Build Coastguard Worker "mknod(%s, %#o, 0) failed, errno=%d : %s",
127*49cdfc7eSAndroid Build Coastguard Worker node_name, MODE_RWX, TEST_ERRNO,
128*49cdfc7eSAndroid Build Coastguard Worker strerror(TEST_ERRNO));
129*49cdfc7eSAndroid Build Coastguard Worker continue;
130*49cdfc7eSAndroid Build Coastguard Worker }
131*49cdfc7eSAndroid Build Coastguard Worker /* Set the functionality flag */
132*49cdfc7eSAndroid Build Coastguard Worker fflag = 1;
133*49cdfc7eSAndroid Build Coastguard Worker
134*49cdfc7eSAndroid Build Coastguard Worker /* Check for node's creation */
135*49cdfc7eSAndroid Build Coastguard Worker if (stat(node_name, &buf) < 0) {
136*49cdfc7eSAndroid Build Coastguard Worker tst_resm(TFAIL,
137*49cdfc7eSAndroid Build Coastguard Worker "stat() of %s failed, errno:%d",
138*49cdfc7eSAndroid Build Coastguard Worker node_name, TEST_ERRNO);
139*49cdfc7eSAndroid Build Coastguard Worker /* unset flag as functionality fails */
140*49cdfc7eSAndroid Build Coastguard Worker fflag = 0;
141*49cdfc7eSAndroid Build Coastguard Worker }
142*49cdfc7eSAndroid Build Coastguard Worker
143*49cdfc7eSAndroid Build Coastguard Worker /* Verify mode permissions of node */
144*49cdfc7eSAndroid Build Coastguard Worker if (buf.st_mode & S_ISGID) {
145*49cdfc7eSAndroid Build Coastguard Worker tst_resm(TFAIL, "%s: Incorrect modes, setgid "
146*49cdfc7eSAndroid Build Coastguard Worker "bit set", node_name);
147*49cdfc7eSAndroid Build Coastguard Worker /* unset flag as functionality fails */
148*49cdfc7eSAndroid Build Coastguard Worker fflag = 0;
149*49cdfc7eSAndroid Build Coastguard Worker }
150*49cdfc7eSAndroid Build Coastguard Worker
151*49cdfc7eSAndroid Build Coastguard Worker /* Verify group ID */
152*49cdfc7eSAndroid Build Coastguard Worker if (buf.st_gid != mygid) {
153*49cdfc7eSAndroid Build Coastguard Worker tst_resm(TFAIL, "%s: Incorrect group",
154*49cdfc7eSAndroid Build Coastguard Worker node_name);
155*49cdfc7eSAndroid Build Coastguard Worker /* unset flag as functionality fails */
156*49cdfc7eSAndroid Build Coastguard Worker fflag = 0;
157*49cdfc7eSAndroid Build Coastguard Worker }
158*49cdfc7eSAndroid Build Coastguard Worker if (fflag) {
159*49cdfc7eSAndroid Build Coastguard Worker tst_resm(TPASS, "Functionality of mknod(%s, "
160*49cdfc7eSAndroid Build Coastguard Worker "%#o, 0) successful",
161*49cdfc7eSAndroid Build Coastguard Worker node_name, MODE_RWX);
162*49cdfc7eSAndroid Build Coastguard Worker }
163*49cdfc7eSAndroid Build Coastguard Worker
164*49cdfc7eSAndroid Build Coastguard Worker /* Remove the node for the next go `round */
165*49cdfc7eSAndroid Build Coastguard Worker if (unlink(node_name) == -1) {
166*49cdfc7eSAndroid Build Coastguard Worker tst_resm(TWARN,
167*49cdfc7eSAndroid Build Coastguard Worker "unlink(%s) failed, errno:%d %s",
168*49cdfc7eSAndroid Build Coastguard Worker node_name, errno, strerror(errno));
169*49cdfc7eSAndroid Build Coastguard Worker }
170*49cdfc7eSAndroid Build Coastguard Worker }
171*49cdfc7eSAndroid Build Coastguard Worker
172*49cdfc7eSAndroid Build Coastguard Worker /* Change the directory back to temporary directory */
173*49cdfc7eSAndroid Build Coastguard Worker SAFE_CHDIR(cleanup, "..");
174*49cdfc7eSAndroid Build Coastguard Worker
175*49cdfc7eSAndroid Build Coastguard Worker /*
176*49cdfc7eSAndroid Build Coastguard Worker * Invoke cleanup() to delete the test directories created
177*49cdfc7eSAndroid Build Coastguard Worker * in the setup() and exit main().
178*49cdfc7eSAndroid Build Coastguard Worker */
179*49cdfc7eSAndroid Build Coastguard Worker cleanup();
180*49cdfc7eSAndroid Build Coastguard Worker
181*49cdfc7eSAndroid Build Coastguard Worker tst_exit();
182*49cdfc7eSAndroid Build Coastguard Worker }
183*49cdfc7eSAndroid Build Coastguard Worker
184*49cdfc7eSAndroid Build Coastguard Worker /*
185*49cdfc7eSAndroid Build Coastguard Worker * setup(void) - performs all ONE TIME setup for this test.
186*49cdfc7eSAndroid Build Coastguard Worker * Exit the test program on receipt of unexpected signals.
187*49cdfc7eSAndroid Build Coastguard Worker * Create a temporary directory used to hold test directories created
188*49cdfc7eSAndroid Build Coastguard Worker * and change the directory to it.
189*49cdfc7eSAndroid Build Coastguard Worker * Verify that pid of process executing the test is root.
190*49cdfc7eSAndroid Build Coastguard Worker * Create a test directory on temporary directory and set the ownership
191*49cdfc7eSAndroid Build Coastguard Worker * of test directory to nobody user.
192*49cdfc7eSAndroid Build Coastguard Worker * Set the effective uid/gid of the process to that of nobody user.
193*49cdfc7eSAndroid Build Coastguard Worker */
setup(void)194*49cdfc7eSAndroid Build Coastguard Worker void setup(void)
195*49cdfc7eSAndroid Build Coastguard Worker {
196*49cdfc7eSAndroid Build Coastguard Worker tst_require_root();
197*49cdfc7eSAndroid Build Coastguard Worker
198*49cdfc7eSAndroid Build Coastguard Worker /* Capture unexpected signals */
199*49cdfc7eSAndroid Build Coastguard Worker tst_sig(NOFORK, DEF_HANDLER, cleanup);
200*49cdfc7eSAndroid Build Coastguard Worker
201*49cdfc7eSAndroid Build Coastguard Worker TEST_PAUSE;
202*49cdfc7eSAndroid Build Coastguard Worker
203*49cdfc7eSAndroid Build Coastguard Worker /* Make a temp dir and cd to it */
204*49cdfc7eSAndroid Build Coastguard Worker tst_tmpdir();
205*49cdfc7eSAndroid Build Coastguard Worker
206*49cdfc7eSAndroid Build Coastguard Worker /* fix permissions on the tmpdir */
207*49cdfc7eSAndroid Build Coastguard Worker if (chmod(".", 0711) != 0) {
208*49cdfc7eSAndroid Build Coastguard Worker tst_brkm(TBROK, cleanup, "chmod() failed");
209*49cdfc7eSAndroid Build Coastguard Worker }
210*49cdfc7eSAndroid Build Coastguard Worker
211*49cdfc7eSAndroid Build Coastguard Worker /* Save the real user id of the test process */
212*49cdfc7eSAndroid Build Coastguard Worker save_myuid = getuid();
213*49cdfc7eSAndroid Build Coastguard Worker
214*49cdfc7eSAndroid Build Coastguard Worker /* Save the process id of the test process */
215*49cdfc7eSAndroid Build Coastguard Worker mypid = getpid();
216*49cdfc7eSAndroid Build Coastguard Worker
217*49cdfc7eSAndroid Build Coastguard Worker /* Get the node name to be created in the test */
218*49cdfc7eSAndroid Build Coastguard Worker sprintf(node_name, TNODE, mypid);
219*49cdfc7eSAndroid Build Coastguard Worker
220*49cdfc7eSAndroid Build Coastguard Worker /* Get the uid/gid of guest user - nobody */
221*49cdfc7eSAndroid Build Coastguard Worker if ((user1 = getpwnam(LTPUSER)) == NULL) {
222*49cdfc7eSAndroid Build Coastguard Worker tst_brkm(TBROK, cleanup, "%s not in /etc/passwd", LTPUSER);
223*49cdfc7eSAndroid Build Coastguard Worker }
224*49cdfc7eSAndroid Build Coastguard Worker user1_uid = user1->pw_uid;
225*49cdfc7eSAndroid Build Coastguard Worker group1_gid = user1->pw_gid;
226*49cdfc7eSAndroid Build Coastguard Worker
227*49cdfc7eSAndroid Build Coastguard Worker /* Get effective group id of the test process */
228*49cdfc7eSAndroid Build Coastguard Worker group2_gid = getegid();
229*49cdfc7eSAndroid Build Coastguard Worker
230*49cdfc7eSAndroid Build Coastguard Worker /*
231*49cdfc7eSAndroid Build Coastguard Worker * Create a test directory under temporary directory with the
232*49cdfc7eSAndroid Build Coastguard Worker * specified mode permissions, with uid/gid set to that of guest
233*49cdfc7eSAndroid Build Coastguard Worker * user and the test process.
234*49cdfc7eSAndroid Build Coastguard Worker */
235*49cdfc7eSAndroid Build Coastguard Worker SAFE_MKDIR(cleanup, DIR_TEMP, MODE_RWX);
236*49cdfc7eSAndroid Build Coastguard Worker SAFE_CHOWN(cleanup, DIR_TEMP, user1_uid, group2_gid);
237*49cdfc7eSAndroid Build Coastguard Worker
238*49cdfc7eSAndroid Build Coastguard Worker /*
239*49cdfc7eSAndroid Build Coastguard Worker * Verify that test directory created with expected permission modes
240*49cdfc7eSAndroid Build Coastguard Worker * and ownerships.
241*49cdfc7eSAndroid Build Coastguard Worker */
242*49cdfc7eSAndroid Build Coastguard Worker SAFE_STAT(cleanup, DIR_TEMP, &buf);
243*49cdfc7eSAndroid Build Coastguard Worker
244*49cdfc7eSAndroid Build Coastguard Worker /* Verify modes of test directory */
245*49cdfc7eSAndroid Build Coastguard Worker if (buf.st_mode & S_ISGID) {
246*49cdfc7eSAndroid Build Coastguard Worker tst_brkm(TBROK, cleanup,
247*49cdfc7eSAndroid Build Coastguard Worker "%s: Incorrect modes, setgid bit set", DIR_TEMP);
248*49cdfc7eSAndroid Build Coastguard Worker }
249*49cdfc7eSAndroid Build Coastguard Worker
250*49cdfc7eSAndroid Build Coastguard Worker /* Verify group ID */
251*49cdfc7eSAndroid Build Coastguard Worker if (buf.st_gid != group2_gid) {
252*49cdfc7eSAndroid Build Coastguard Worker tst_brkm(TBROK, cleanup, "%s: Incorrect group", DIR_TEMP);
253*49cdfc7eSAndroid Build Coastguard Worker }
254*49cdfc7eSAndroid Build Coastguard Worker
255*49cdfc7eSAndroid Build Coastguard Worker /*
256*49cdfc7eSAndroid Build Coastguard Worker * Set the effective group id and user id of the test process
257*49cdfc7eSAndroid Build Coastguard Worker * to that of guest user.
258*49cdfc7eSAndroid Build Coastguard Worker */
259*49cdfc7eSAndroid Build Coastguard Worker SAFE_SETGID(cleanup, group1_gid);
260*49cdfc7eSAndroid Build Coastguard Worker if (setreuid(-1, user1_uid) < 0) {
261*49cdfc7eSAndroid Build Coastguard Worker tst_brkm(TBROK, cleanup,
262*49cdfc7eSAndroid Build Coastguard Worker "Unable to set process uid to that of ltp user");
263*49cdfc7eSAndroid Build Coastguard Worker }
264*49cdfc7eSAndroid Build Coastguard Worker
265*49cdfc7eSAndroid Build Coastguard Worker /* Save the real group ID of the current process */
266*49cdfc7eSAndroid Build Coastguard Worker mygid = getgid();
267*49cdfc7eSAndroid Build Coastguard Worker
268*49cdfc7eSAndroid Build Coastguard Worker /* Change directory to DIR_TEMP */
269*49cdfc7eSAndroid Build Coastguard Worker SAFE_CHDIR(cleanup, DIR_TEMP);
270*49cdfc7eSAndroid Build Coastguard Worker }
271*49cdfc7eSAndroid Build Coastguard Worker
272*49cdfc7eSAndroid Build Coastguard Worker /*
273*49cdfc7eSAndroid Build Coastguard Worker * cleanup() - Performs all ONE TIME cleanup for this test at
274*49cdfc7eSAndroid Build Coastguard Worker * completion or premature exit.
275*49cdfc7eSAndroid Build Coastguard Worker * Print test timing stats and errno log if test executed with options.
276*49cdfc7eSAndroid Build Coastguard Worker * Restore the real/effective user id of the process changed during
277*49cdfc7eSAndroid Build Coastguard Worker * setup().
278*49cdfc7eSAndroid Build Coastguard Worker * Remove temporary directory and sub-directories/files under it
279*49cdfc7eSAndroid Build Coastguard Worker * created during setup().
280*49cdfc7eSAndroid Build Coastguard Worker * Exit the test program with normal exit code.
281*49cdfc7eSAndroid Build Coastguard Worker */
cleanup(void)282*49cdfc7eSAndroid Build Coastguard Worker void cleanup(void)
283*49cdfc7eSAndroid Build Coastguard Worker {
284*49cdfc7eSAndroid Build Coastguard Worker
285*49cdfc7eSAndroid Build Coastguard Worker /*
286*49cdfc7eSAndroid Build Coastguard Worker * Restore the effective uid of the process changed in the
287*49cdfc7eSAndroid Build Coastguard Worker * setup().
288*49cdfc7eSAndroid Build Coastguard Worker */
289*49cdfc7eSAndroid Build Coastguard Worker if (setreuid(-1, save_myuid) < 0) {
290*49cdfc7eSAndroid Build Coastguard Worker tst_brkm(TBROK, NULL,
291*49cdfc7eSAndroid Build Coastguard Worker "resetting process real/effective uid failed");
292*49cdfc7eSAndroid Build Coastguard Worker }
293*49cdfc7eSAndroid Build Coastguard Worker
294*49cdfc7eSAndroid Build Coastguard Worker tst_rmdir();
295*49cdfc7eSAndroid Build Coastguard Worker
296*49cdfc7eSAndroid Build Coastguard Worker }
297