xref: /aosp_15_r20/external/ltp/include/tst_safe_stdio.h (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker /* SPDX-License-Identifier: GPL-2.0-or-later
2*49cdfc7eSAndroid Build Coastguard Worker  * Copyright (c) 2013-2016 Cyril Hrubis <[email protected]>
3*49cdfc7eSAndroid Build Coastguard Worker  */
4*49cdfc7eSAndroid Build Coastguard Worker 
5*49cdfc7eSAndroid Build Coastguard Worker #ifndef TST_SAFE_STDIO_H__
6*49cdfc7eSAndroid Build Coastguard Worker #define TST_SAFE_STDIO_H__
7*49cdfc7eSAndroid Build Coastguard Worker 
8*49cdfc7eSAndroid Build Coastguard Worker #include <stdio.h>
9*49cdfc7eSAndroid Build Coastguard Worker 
10*49cdfc7eSAndroid Build Coastguard Worker #include "safe_stdio_fn.h"
11*49cdfc7eSAndroid Build Coastguard Worker 
12*49cdfc7eSAndroid Build Coastguard Worker #define SAFE_FOPEN(path, mode) \
13*49cdfc7eSAndroid Build Coastguard Worker 	safe_fopen(__FILE__, __LINE__, NULL, path, mode)
14*49cdfc7eSAndroid Build Coastguard Worker 
15*49cdfc7eSAndroid Build Coastguard Worker #define SAFE_FCLOSE(f) \
16*49cdfc7eSAndroid Build Coastguard Worker 	safe_fclose(__FILE__, __LINE__, NULL, f)
17*49cdfc7eSAndroid Build Coastguard Worker 
18*49cdfc7eSAndroid Build Coastguard Worker #define SAFE_ASPRINTF(strp, fmt, ...) \
19*49cdfc7eSAndroid Build Coastguard Worker 	safe_asprintf(__FILE__, __LINE__, NULL, strp, fmt, __VA_ARGS__)
20*49cdfc7eSAndroid Build Coastguard Worker 
21*49cdfc7eSAndroid Build Coastguard Worker #define SAFE_POPEN(command, type) \
22*49cdfc7eSAndroid Build Coastguard Worker 	safe_popen(__FILE__, __LINE__, NULL, command, type)
23*49cdfc7eSAndroid Build Coastguard Worker 
24*49cdfc7eSAndroid Build Coastguard Worker #endif /* TST_SAFE_STDIO_H__ */
25