Various fixes for compilation with mingw

This commit is contained in:
Orion Poplawski 2023-05-09 07:58:05 -06:00
parent e96d278bfc
commit e729628f3a
3 changed files with 13 additions and 0 deletions

View file

@ -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."));

View file

@ -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);

View file

@ -21,6 +21,11 @@
#include <config.h>
#endif
/* To define _WIN32_WINT */
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
#if !defined(HAVE_ARPA_INET_H) && defined(OS_IS_WIN32) && (_WIN32_WINNT < 0x0600)
#include <errno.h>