summaryrefslogtreecommitdiffstats
path: root/src/socket-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-07-11 22:20:08 +0000
committerLennart Poettering <lennart@poettering.net>2004-07-11 22:20:08 +0000
commit216591d95e00a0cb771088dad9a752efead55e10 (patch)
tree5758e5a203f2db6cda624efbbd644feefa048704 /src/socket-util.c
parenta96ed347a30fdc7494b96542c0ad8a19ef178b25 (diff)
make the protocol plugins make use of modargs
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@62 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/socket-util.c')
-rw-r--r--src/socket-util.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/socket-util.c b/src/socket-util.c
index f9451af8..f4648da5 100644
--- a/src/socket-util.c
+++ b/src/socket-util.c
@@ -14,6 +14,7 @@
#include <netinet/ip.h>
#include "socket-util.h"
+#include "util.h"
void pa_socket_peer_to_string(int fd, char *c, size_t l) {
struct stat st;
@@ -150,3 +151,41 @@ int pa_unix_socket_remove_stale(const char *fn) {
return 0;
}
+
+int pa_unix_socket_make_secure_dir(const char *fn) {
+ int ret = -1;
+ char *slash, *dir = strdup(fn);
+ assert(dir);
+
+ if (!(slash = strrchr(dir, '/')))
+ goto finish;
+ *slash = 0;
+
+ if (pa_make_secure_dir(dir) < 0)
+ goto finish;
+
+ ret = 0;
+
+finish:
+ free(dir);
+ return ret;
+}
+
+int pa_unix_socket_remove_secure_dir(const char *fn) {
+ int ret = -1;
+ char *slash, *dir = strdup(fn);
+ assert(dir);
+
+ if (!(slash = strrchr(dir, '/')))
+ goto finish;
+ *slash = 0;
+
+ if (rmdir(dir) < 0)
+ goto finish;
+
+ ret = 0;
+
+finish:
+ free(dir);
+ return ret;
+}