From e729628f3aa64a150bd83b373260f0b4dc6590b7 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Tue, 9 May 2023 07:58:05 -0600 Subject: [PATCH] Various fixes for compilation with mingw --- src/daemon/main.c | 4 ++++ src/modules/module-console-kit.c | 4 ++++ src/pulsecore/arpa-inet.c | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/src/daemon/main.c b/src/daemon/main.c index 924a4d4aa..1e531c31f 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -683,7 +683,11 @@ int main(int argc, char *argv[]) { pa_assert_not_reached(); } +#ifdef HAVE_GETUID start_server = conf->local_server_type == PA_SERVER_TYPE_USER || (getuid() == 0 && conf->local_server_type == PA_SERVER_TYPE_SYSTEM); +#else + start_server = conf->local_server_type == PA_SERVER_TYPE_USER || conf->local_server_type == PA_SERVER_TYPE_SYSTEM; +#endif if (!start_server && conf->local_server_type == PA_SERVER_TYPE_SYSTEM) { pa_log_notice(_("System mode refused for non-root user. Only starting the D-Bus server lookup service.")); diff --git a/src/modules/module-console-kit.c b/src/modules/module-console-kit.c index c8fe2ed24..78ad3a95f 100644 --- a/src/modules/module-console-kit.c +++ b/src/modules/module-console-kit.c @@ -93,9 +93,11 @@ static void add_session(struct userdata *u, const char *id) { } } +#ifdef HAVE_GETUID /* We only care about our own sessions */ if ((uid_t) uid != getuid()) goto fail; +#endif session = pa_xnew(struct session, 1); session->id = pa_xstrdup(id); @@ -221,11 +223,13 @@ static int get_session_list(struct userdata *u) { goto fail; } +#ifdef HAVE_GETUID uid = (uint32_t) getuid(); if (!(dbus_message_append_args(m, DBUS_TYPE_UINT32, &uid, DBUS_TYPE_INVALID))) { pa_log("Failed to append arguments to GetSessionsForUnixUser() method call."); goto fail; } +#endif if (!(reply = dbus_connection_send_with_reply_and_block(pa_dbus_connection_get(u->connection), m, -1, &error))) { pa_log("GetSessionsForUnixUser() call failed: %s: %s", error.name, error.message); diff --git a/src/pulsecore/arpa-inet.c b/src/pulsecore/arpa-inet.c index fb342994b..2e3fc010c 100644 --- a/src/pulsecore/arpa-inet.c +++ b/src/pulsecore/arpa-inet.c @@ -21,6 +21,11 @@ #include #endif +/* To define _WIN32_WINT */ +#ifdef HAVE_WINDOWS_H +#include +#endif + #if !defined(HAVE_ARPA_INET_H) && defined(OS_IS_WIN32) && (_WIN32_WINNT < 0x0600) #include