mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
esound protocol
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@40 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
a74cd2a1bd
commit
ef422fa4ae
18 changed files with 806 additions and 46 deletions
23
src/util.c
23
src/util.c
|
|
@ -1,9 +1,12 @@
|
|||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/un.h>
|
||||
#include <netinet/in.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
|
|
@ -60,3 +63,23 @@ void peer_to_string(char *c, size_t l, int fd) {
|
|||
|
||||
snprintf(c, l, "Unknown client");
|
||||
}
|
||||
|
||||
int make_secure_dir(const char* dir) {
|
||||
struct stat st;
|
||||
|
||||
if (mkdir(dir, 0700) < 0)
|
||||
if (errno != EEXIST)
|
||||
return -1;
|
||||
|
||||
if (lstat(dir, &st) < 0)
|
||||
goto fail;
|
||||
|
||||
if (!S_ISDIR(st.st_mode) || (st.st_uid != getuid()) || ((st.st_mode & 0777) != 0700))
|
||||
goto fail;
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
rmdir(dir);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue