xref: /aosp_15_r20/external/ltp/testcases/kernel/security/filecaps/filecaps_common.h (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1 #include <limits.h>
2 #include <stdlib.h>
3 #include <old_tmpdir.h>
4 
5 static char *fifofile;
6 
get_caps_fifo(void)7 static const char *get_caps_fifo(void)
8 {
9 	if (!fifofile) {
10 		fifofile = getenv("FIFOFILE");
11 
12 		if (!fifofile) {
13 			const char *tmpdir = tst_get_tmpdir_root();
14 
15 			fifofile = malloc(PATH_MAX);
16 			snprintf(fifofile, PATH_MAX, "%s/caps_fifo", tmpdir);
17 		}
18 	}
19 
20 	return fifofile;
21 }
22