From 8bc69ba508e2ec6e573ba197d0f20b1a39a1c920 Mon Sep 17 00:00:00 2001 From: Fabian Deutsch Date: Tue, 4 Oct 2011 13:28:38 +0200 Subject: [PATCH] Use a subdirectory for temporary files. This allows the a better integration with selinux, as the rule can use the path name and doesn't need globbing. Signed-off-by: Fabian Deutsch --- orc/orccodemem.c | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/orc/orccodemem.c b/orc/orccodemem.c index f470be5..e125faa 100644 --- a/orc/orccodemem.c +++ b/orc/orccodemem.c @@ -193,11 +193,27 @@ orc_code_chunk_free (OrcCodeChunk *chunk) #ifdef HAVE_CODEMEM_MMAP int orc_code_region_allocate_codemem_dual_map (OrcCodeRegion *region, - const char *dir, int force_unlink) + const char *basedir, int force_unlink) { int fd; int n; char *filename; + char *dir; + struct stat stat_p; + + dir = malloc (strlen (basedir) + strlen ("/.orc")); + sprintf (dir, "%s/.orc", basedir); + + stat (dir, &stat_p); + if (!S_ISDIR (stat_p.st_mode)) + { + n = mkdir (dir, S_IRWXU); + if (n < 0) + { + ORC_WARNING ("failed to create subdir"); + return FALSE; + } + } filename = malloc (strlen ("/orcexec..") + strlen (dir) + 6 + 1); -- 1.7.6.4