xref: /third_party/ltp/testcases/kernel/security/filecaps/filecaps_common.h
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/ltp/testcases/kernel/security/filecaps/
1f08c3bdfSopenharmony_ci#include <limits.h>
2f08c3bdfSopenharmony_ci#include <stdlib.h>
3f08c3bdfSopenharmony_ci#include <old_tmpdir.h>
4f08c3bdfSopenharmony_ci
5f08c3bdfSopenharmony_cistatic char *fifofile;
6f08c3bdfSopenharmony_ci
7f08c3bdfSopenharmony_cistatic const char *get_caps_fifo(void)
8f08c3bdfSopenharmony_ci{
9f08c3bdfSopenharmony_ci	if (!fifofile) {
10f08c3bdfSopenharmony_ci		fifofile = getenv("FIFOFILE");
11f08c3bdfSopenharmony_ci
12f08c3bdfSopenharmony_ci		if (!fifofile) {
13f08c3bdfSopenharmony_ci			const char *tmpdir = tst_get_tmpdir_root();
14f08c3bdfSopenharmony_ci
15f08c3bdfSopenharmony_ci			fifofile = malloc(PATH_MAX);
16f08c3bdfSopenharmony_ci			snprintf(fifofile, PATH_MAX, "%s/caps_fifo", tmpdir);
17f08c3bdfSopenharmony_ci		}
18f08c3bdfSopenharmony_ci	}
19f08c3bdfSopenharmony_ci
20f08c3bdfSopenharmony_ci	return fifofile;
21f08c3bdfSopenharmony_ci}
22

Indexes created Thu Nov 07 10:32:03 CST 2024