summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/polypcore/util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/polypcore/util.c b/src/polypcore/util.c
index b37a25a3..8418a692 100644
--- a/src/polypcore/util.c
+++ b/src/polypcore/util.c
@@ -140,13 +140,16 @@ int pa_make_secure_dir(const char* dir) {
if (errno != EEXIST)
return -1;
+ chown(dir, getuid(), getgid());
+ chmod(dir, 0700);
+
#ifdef HAVE_LSTAT
if (lstat(dir, &st) < 0)
#else
if (stat(dir, &st) < 0)
#endif
goto fail;
-
+
#ifndef OS_IS_WIN32
if (!S_ISDIR(st.st_mode) || (st.st_uid != getuid()) || ((st.st_mode & 0777) != 0700))
goto fail;