summaryrefslogtreecommitdiffstats
path: root/main.cxx
diff options
context:
space:
mode:
authorfche <fche>2008-01-02 18:22:28 +0000
committerfche <fche>2008-01-02 18:22:28 +0000
commit533af4f0fdd9c80cd0d9560b2363fdec36c08ec1 (patch)
tree6fffe9de9fb520be8651a454a6760be8d8628021 /main.cxx
parent212fcc465abe7e7806a9b0a21385bd645cd13177 (diff)
downloadsystemtap-steved-533af4f0fdd9c80cd0d9560b2363fdec36c08ec1.tar.gz
systemtap-steved-533af4f0fdd9c80cd0d9560b2363fdec36c08ec1.tar.xz
systemtap-steved-533af4f0fdd9c80cd0d9560b2363fdec36c08ec1.zip
Fix mkdtemp() umask issue
Even though the mkdtemp() man page indicates that the directory will be created with always 0700 permissions, it is actually affected by the process's umask. So, if you run stap with an unusual umask it can end up creating the temp dir with permissions that staprun can't handle e.g.: $> rpm -q systemtap systemtap-0.6-1.fc9 $> umask 0122 $> stap -e 'probe begin { println("foo") exit() }' ERROR: Error opening '/tmp/stapV4pBIb/stap_725b9bc541cef2618a5ccbc58bb64d15_287.ko': Permission denied Obvious solution is to briefly set the umask to zero in stap so as to ensure 0700 permissions. Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Diffstat (limited to 'main.cxx')
-rw-r--r--main.cxx2
1 files changed, 2 insertions, 0 deletions
diff --git a/main.cxx b/main.cxx
index 1880436f..556b30ff 100644
--- a/main.cxx
+++ b/main.cxx
@@ -521,7 +521,9 @@ main (int argc, char * const argv [])
string stapdir = "/stapXXXXXX";
string tmpdirt = tmpdir_env + stapdir;
+ mode_t mask = umask(0);
const char* tmpdir = mkdtemp((char *)tmpdirt.c_str());
+ umask(mask);
if (! tmpdir)
{
const char* e = strerror (errno);