1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* 3 * Copyright (c) International Business Machines Corp., 2001 4 */ 5 6 /* 7 * DESCRIPTION 8 * fchdir01 - create a directory and cd into it. 9 */ 10 11 #include "tst_test.h" 12 13 static int fd; 14 static const char *TEST_DIR = "alpha"; 15 16 #define MODES S_IRWXU 17 verify_fchdir(void)18static void verify_fchdir(void) 19 { 20 TST_EXP_PASS(fchdir(fd)); 21 } 22 setup(void)23static void setup(void) 24 { 25 SAFE_MKDIR(TEST_DIR, MODES); 26 fd = SAFE_OPEN(TEST_DIR, O_RDONLY); 27 } 28 cleanup(void)29static void cleanup(void) 30 { 31 SAFE_CLOSE(fd); 32 } 33 34 static struct tst_test test = { 35 .test_all = verify_fchdir, 36 .setup = setup, 37 .cleanup = cleanup, 38 .needs_tmpdir = 1, 39 }; 40