On 06/11/2012 09:48 AM, Arun Raghavan wrote:
This makes pa_make_secure_dir() create any missing parent directories in
the given path as well. This is useful, for example, on a pristine
system with a clean $HOME that needs ~/.config/pulse/ to be created when
~/.config does not exist.

Hum, is moving from ~/.pulse to ~/.config/pulse something we've done post 2.0? Or is this patch to make it easier for special configurations?

---
  src/pulsecore/core-util.c |    6 ++++++
  1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 82480c6..5270979 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -230,6 +230,12 @@ int pa_make_secure_dir(const char* dir, mode_t m, uid_t 
uid, gid_t gid) {
      mode_t u;
      u = umask((~m)&  0777);
      r = mkdir(dir, m);
+    if (r<  0&&  errno == ENOENT) {
+        /* If a parent directory in the path doesn't exist, try to create that
+         * first, then try again. */
+        pa_make_secure_parent_dir(dir, m, uid, gid);

Hm, is there a possibility to get infinite recursion by specifying strange paths such as ./ and ../ here?

+        r = mkdir(dir, m);
+    }
      umask(u);
  }
  #endif



--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
_______________________________________________
pulseaudio-discuss mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to