xref: /aosp_15_r20/external/ltp/testcases/kernel/syscalls/open/open03.c (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (c) Linux Test Project, 2001-2022
4  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
5  */
6 
7 /*\
8  * [Description]
9  *
10  * Testcase to check open() with O_RDWR | O_CREAT.
11  */
12 
13 #include "tst_test.h"
14 
15 #define TEST_FILE "testfile"
16 
verify_open(void)17 static void verify_open(void)
18 {
19 	TST_EXP_FD(open(TEST_FILE, O_RDWR | O_CREAT, 0700));
20 	SAFE_CLOSE(TST_RET);
21 	SAFE_UNLINK(TEST_FILE);
22 }
23 
24 
25 
26 static struct tst_test test = {
27 	.needs_tmpdir = 1,
28 	.test_all = verify_open,
29 };
30