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