diff options
author | Ryan Pavlik <rpavlik@iastate.edu> | 2011-10-21 12:32:49 -0500 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2012-10-29 12:23:12 +0000 |
commit | f32ad6dd314a587c301b7f1a6e4ee74e5d8cc06c (patch) | |
tree | 963fdf5a8dcb86a4dac4db2a8a909ecc26fed693 /os | |
parent | 74735c5ebff15db8891808068fe8569d8ccde9e7 (diff) |
os/utils.c: Provide only stubs for Lock/UnlockServer on WIN32
MinGW and MSVC lack the POSIX functions to compile the lock file code.
Signed-off-by: Ryan Pavlik <rpavlik@iastate.edu>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Diffstat (limited to 'os')
-rw-r--r-- | os/utils.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/os/utils.c b/os/utils.c index 04bcbc61f..3c520add5 100644 --- a/os/utils.c +++ b/os/utils.c @@ -235,6 +235,19 @@ OsSignal(int sig, OsSigHandlerPtr handler) #define LOCK_PREFIX "/.X" #define LOCK_SUFFIX "-lock" +#if !defined(WIN32) || defined(__CYGWIN__) +#define LOCK_SERVER +#endif + +#ifndef LOCK_SERVER +void +LockServer(void) +{} + +void +UnlockServer(void) +{} +#else /* LOCK_SERVER */ static Bool StillLocking = FALSE; static char LockFile[PATH_MAX]; static Bool nolock = FALSE; @@ -382,6 +395,7 @@ UnlockServer(void) (void) unlink(LockFile); } } +#endif /* LOCK_SERVER */ /* Force connections to close on SIGHUP from init */ @@ -503,7 +517,9 @@ UseMsg(void) #ifdef RLIMIT_STACK ErrorF("-ls int limit stack space to N Kb\n"); #endif +#ifdef LOCK_SERVER ErrorF("-nolock disable the locking mechanism\n"); +#endif ErrorF("-nolisten string don't listen on protocol\n"); ErrorF("-noreset don't reset after last client exists\n"); ErrorF("-background [none] create root window with no background\n"); @@ -664,7 +680,9 @@ ProcessCommandLine(int argc, char *argv[]) if (++i < argc) { displayfd = atoi(argv[i]); display = NULL; +#ifdef LOCK_SERVER nolock = TRUE; +#endif } else UseMsg(); @@ -744,6 +762,7 @@ ProcessCommandLine(int argc, char *argv[]) UseMsg(); } #endif +#ifdef LOCK_SERVER else if (strcmp(argv[i], "-nolock") == 0) { #if !defined(WIN32) && !defined(__CYGWIN__) if (getuid() != 0) @@ -753,6 +772,7 @@ ProcessCommandLine(int argc, char *argv[]) #endif nolock = TRUE; } +#endif else if (strcmp(argv[i], "-nolisten") == 0) { if (++i < argc) { if (_XSERVTransNoListen(argv[i])) |