/** Creates a directory securely */
int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
struct stat st;
- int r, saved_errno, fd;
+ int r, saved_errno;
pa_assert(dir);
return -1;
#if defined(HAVE_FSTAT) && !defined(OS_IS_WIN32)
+{
+ int fd;
if ((fd = open(dir,
#ifdef O_CLOEXEC
O_CLOEXEC|
#endif
pa_assert_se(pa_close(fd) >= 0);
+}
#endif
#ifdef HAVE_LSTAT
pa_log_info("Successfully acquired real-time thread priority.");
return 0;
-#elif _POSIX_PRIORITY_SCHEDULING
+#elif defined(_POSIX_PRIORITY_SCHEDULING)
int p;
if (set_scheduler(rtprio) >= 0) {
/* Try to parse a boolean string value.*/
int pa_parse_boolean(const char *v) {
- const char *expr;
pa_assert(v);
/* First we check language independant */
return 0;
#ifdef HAVE_LANGINFO_H
+{
+ const char *expr;
/* And then we check language dependant */
if ((expr = nl_langinfo(YESEXPR)))
if (expr[0])
if (expr[0])
if (pa_match(expr, v) > 0)
return 0;
+}
#endif
errno = EINVAL;
char *pa_get_runtime_dir(void) {
char *d, *k = NULL, *p = NULL, *t = NULL, *mid;
- struct stat st;
mode_t m;
/* The runtime directory shall contain dynamic data that needs NOT
goto fail;
}
- /* Hmm, so this symlink is still around, make sure nobody fools
- * us */
-
+ /* Hmm, so this symlink is still around, make sure nobody fools us */
#ifdef HAVE_LSTAT
+{
+ struct stat st;
if (lstat(p, &st) < 0) {
if (errno != ENOENT) {
pa_log_info("Hmm, runtime path exists, but points to an invalid directory. Changing runtime directory.");
}
+}
#endif
pa_xfree(p);
#endif
const void *a;
size_t size;
- int r;
+ int r = ENOTSUP;
size_t bs;
pa_assert(p);