summaryrefslogtreecommitdiffstats
path: root/src/pulsecore
diff options
context:
space:
mode:
Diffstat (limited to 'src/pulsecore')
-rw-r--r--src/pulsecore/arpa-inet.c1
-rw-r--r--src/pulsecore/cli-command.c4
-rw-r--r--src/pulsecore/core-util.c21
-rw-r--r--src/pulsecore/dllmain.c2
-rw-r--r--src/pulsecore/random.c4
-rw-r--r--src/pulsecore/shm.c2
-rw-r--r--src/pulsecore/socket-util.c8
-rw-r--r--src/pulsecore/start-child.c4
8 files changed, 29 insertions, 17 deletions
diff --git a/src/pulsecore/arpa-inet.c b/src/pulsecore/arpa-inet.c
index c927ca0b..09570bb0 100644
--- a/src/pulsecore/arpa-inet.c
+++ b/src/pulsecore/arpa-inet.c
@@ -29,6 +29,7 @@
#include <pulsecore/macro.h>
#include <pulsecore/socket.h>
+#include <pulsecore/core-util.h>
#include "arpa-inet.h"
diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
index e5c18065..16c76617 100644
--- a/src/pulsecore/cli-command.c
+++ b/src/pulsecore/cli-command.c
@@ -1574,8 +1574,10 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b
pa_card *card;
pa_bool_t nl;
uint32_t idx;
- char txt[256];
time_t now;
+#ifdef HAVE_CTIME_R
+ char txt[256];
+#endif
pa_core_assert_ref(c);
pa_assert(t);
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 6902ee98..f27f87ae 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -219,7 +219,7 @@ void pa_make_fd_cloexec(int fd) {
/** 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);
@@ -238,6 +238,8 @@ int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
return -1;
#if defined(HAVE_FSTAT) && !defined(OS_IS_WIN32)
+{
+ int fd;
if ((fd = open(dir,
#ifdef O_CLOEXEC
O_CLOEXEC|
@@ -276,6 +278,7 @@ int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
#endif
pa_assert_se(pa_close(fd) >= 0);
+}
#endif
#ifdef HAVE_LSTAT
@@ -728,7 +731,7 @@ int pa_make_realtime(int rtprio) {
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) {
@@ -886,7 +889,6 @@ int pa_match(const char *expr, const char *v) {
/* 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 */
@@ -896,6 +898,8 @@ int pa_parse_boolean(const char *v) {
return 0;
#ifdef HAVE_LANGINFO_H
+{
+ const char *expr;
/* And then we check language dependant */
if ((expr = nl_langinfo(YESEXPR)))
if (expr[0])
@@ -906,6 +910,7 @@ int pa_parse_boolean(const char *v) {
if (expr[0])
if (pa_match(expr, v) > 0)
return 0;
+}
#endif
errno = EINVAL;
@@ -1561,7 +1566,6 @@ static int make_random_dir_and_link(mode_t m, const char *k) {
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
@@ -1641,10 +1645,10 @@ char *pa_get_runtime_dir(void) {
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) {
@@ -1664,6 +1668,7 @@ char *pa_get_runtime_dir(void) {
pa_log_info("Hmm, runtime path exists, but points to an invalid directory. Changing runtime directory.");
}
+}
#endif
pa_xfree(p);
@@ -2203,7 +2208,7 @@ void *pa_will_need(const void *p, size_t l) {
#endif
const void *a;
size_t size;
- int r;
+ int r = ENOTSUP;
size_t bs;
pa_assert(p);
diff --git a/src/pulsecore/dllmain.c b/src/pulsecore/dllmain.c
index 3ee89673..d2de73d9 100644
--- a/src/pulsecore/dllmain.c
+++ b/src/pulsecore/dllmain.c
@@ -31,7 +31,7 @@
#include <windows.h>
#include <winsock2.h>
-extern pa_win32_get_toplevel(HANDLE handle);
+extern char *pa_win32_get_toplevel(HANDLE handle);
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
WSADATA data;
diff --git a/src/pulsecore/random.c b/src/pulsecore/random.c
index 1bd69c2d..b2ec19f0 100644
--- a/src/pulsecore/random.c
+++ b/src/pulsecore/random.c
@@ -49,11 +49,11 @@ static int random_proper(void *ret_data, size_t length) {
#ifdef OS_IS_WIN32
int ret = -1;
+ HCRYPTPROV hCryptProv = 0;
+
pa_assert(ret_data);
pa_assert(length > 0);
- HCRYPTPROV hCryptProv = NULL;
-
if (CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
if(CryptGenRandom(hCryptProv, length, ret_data))
ret = 0;
diff --git a/src/pulsecore/shm.c b/src/pulsecore/shm.c
index da8aff70..442b698e 100644
--- a/src/pulsecore/shm.c
+++ b/src/pulsecore/shm.c
@@ -98,8 +98,10 @@ static char *segment_name(char *fn, size_t l, unsigned id) {
#endif
int pa_shm_create_rw(pa_shm *m, size_t size, pa_bool_t shared, mode_t mode) {
+#ifdef HAVE_SHM_OPEN
char fn[32];
int fd = -1;
+#endif
pa_assert(m);
pa_assert(size > 0);
diff --git a/src/pulsecore/socket-util.c b/src/pulsecore/socket-util.c
index 46623c4d..00fcbc4f 100644
--- a/src/pulsecore/socket-util.c
+++ b/src/pulsecore/socket-util.c
@@ -72,8 +72,9 @@ void pa_socket_peer_to_string(int fd, char *c, size_t l) {
#ifndef OS_IS_WIN32
pa_assert_se(fstat(fd, &st) == 0);
- if (S_ISSOCK(st.st_mode)) {
+ if (S_ISSOCK(st.st_mode))
#endif
+ {
union {
struct sockaddr_storage storage;
struct sockaddr sa;
@@ -118,10 +119,11 @@ void pa_socket_peer_to_string(int fd, char *c, size_t l) {
}
}
-#ifndef OS_IS_WIN32
pa_snprintf(c, l, "Unknown network client");
return;
- } else if (S_ISCHR(st.st_mode) && (fd == 0 || fd == 1)) {
+ }
+#ifndef OS_IS_WIN32
+ else if (S_ISCHR(st.st_mode) && (fd == 0 || fd == 1)) {
pa_snprintf(c, l, "STDIN/STDOUT client");
return;
}
diff --git a/src/pulsecore/start-child.c b/src/pulsecore/start-child.c
index fd1baebb..7f55d4e2 100644
--- a/src/pulsecore/start-child.c
+++ b/src/pulsecore/start-child.c
@@ -45,10 +45,10 @@
#include "start-child.h"
int pa_start_child_for_read(const char *name, const char *argv1, pid_t *pid) {
+#ifdef HAVE_FORK
pid_t child;
int pipe_fds[2] = { -1, -1 };
-#ifdef HAVE_FORK
if (pipe(pipe_fds) < 0) {
pa_log("pipe() failed: %s", pa_cstrerror(errno));
goto fail;
@@ -106,10 +106,10 @@ int pa_start_child_for_read(const char *name, const char *argv1, pid_t *pid) {
execl(name, name, argv1, NULL);
_exit(1);
}
-#endif
fail:
pa_close_pipe(pipe_fds);
+#endif /* HAVE_FORK */
return -1;
}