Listen: use fs/XDG.hxx

This keeps one central place for the XDG switch.  Specifically, this
disables the XDG listener on Apple, where XDG is not supported.
This commit is contained in:
Max Kellermann 2018-10-31 14:30:34 +01:00
parent f47696f5f8
commit 9fc00a817b
1 changed files with 5 additions and 4 deletions

View File

@ -31,6 +31,7 @@
#include "system/Error.hxx"
#include "util/RuntimeError.hxx"
#include "fs/AllocatedPath.hxx"
#include "fs/XDG.hxx"
#include <sys/stat.h>
#include <string.h>
@ -73,10 +74,7 @@ listen_systemd_activation(ClientListener &listener)
static bool
ListenXdgRuntimeDir(ClientListener &listener) noexcept
{
#if defined(_WIN32) || defined(ANDROID) || !defined(HAVE_UN)
(void)listener;
return false;
#else
#if defined(USE_XDG) && defined(HAVE_UN)
if (geteuid() == 0)
/* this MPD instance is a system-wide daemon; don't
use $XDG_RUNTIME_DIR */
@ -107,6 +105,9 @@ ListenXdgRuntimeDir(ClientListener &listener) noexcept
socket_path.c_str());
return false;
}
#else
(void)listener;
return false;
#endif
}