aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-12-29 17:43:00 +0100
committerMax Kellermann <max@duempel.org>2008-12-29 17:43:00 +0100
commitd38a7967ab2bf5c2924a74d46bfe9fe636fd17cd (patch)
treeb1ecc3b4188d2af1c23c3e753af0600c555ab0e2 /src/main.c
parent509d12ae8860648b3367f58152ef04d7a2800c2e (diff)
downloadmpd-d38a7967ab2bf5c2924a74d46bfe9fe636fd17cd.tar.gz
mpd-d38a7967ab2bf5c2924a74d46bfe9fe636fd17cd.tar.xz
mpd-d38a7967ab2bf5c2924a74d46bfe9fe636fd17cd.zip
main: disable non-portable code on WIN32
Disable changeToUser(), daemonize(), killFromPidFile().
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 6d7791b1b..7ccbf1a05 100644
--- a/src/main.c
+++ b/src/main.c
@@ -64,8 +64,11 @@
#include <signal.h>
#include <errno.h>
#include <string.h>
+
+#ifndef WIN32
#include <pwd.h>
#include <grp.h>
+#endif
#ifdef HAVE_LOCALE
#include <locale.h>
@@ -73,6 +76,7 @@
static void changeToUser(void)
{
+#ifndef WIN32
ConfigParam *param = getConfigParam(CONF_USER);
if (param && strlen(param->value)) {
@@ -110,6 +114,7 @@ static void changeToUser(void)
g_setenv("HOME", userpwd->pw_dir, true);
}
}
+#endif
}
static void openDB(Options * options, char *argv0)
@@ -132,6 +137,7 @@ static void openDB(Options * options, char *argv0)
static void daemonize(Options * options)
{
+#ifndef WIN32
FILE *fp = NULL;
ConfigParam *pidFileParam = parseConfigFilePath(CONF_PID_FILE, 0);
@@ -182,6 +188,10 @@ static void daemonize(Options * options)
fprintf(fp, "%lu\n", (unsigned long)getpid());
fclose(fp);
}
+#else
+ /* no daemonization on WIN32 */
+ (void)options;
+#endif
}
static void cleanUpPidFile(void)
@@ -198,6 +208,7 @@ static void cleanUpPidFile(void)
static void killFromPidFile(void)
{
+#ifndef WIN32
FILE *fp;
ConfigParam *pidFileParam = parseConfigFilePath(CONF_PID_FILE, 0);
int pid;
@@ -222,6 +233,9 @@ static void killFromPidFile(void)
pid, strerror(errno));
}
exit(EXIT_SUCCESS);
+#else
+ g_error("--kill is not available on WIN32");
+#endif
}
int main(int argc, char *argv[])