diff options
author | marha <marha@users.sourceforge.net> | 2009-07-28 11:47:02 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-07-28 11:47:02 +0000 |
commit | cabec90cc3716d647e7d3c9396fcfa56cafcbfad (patch) | |
tree | f846844449be9b2a11438cf86ab76977058a50df /xorg-server/os | |
parent | e3cca1a275a55fcc5e074a7cc7aaa5d0764b9659 (diff) | |
download | vcxsrv-cabec90cc3716d647e7d3c9396fcfa56cafcbfad.tar.gz vcxsrv-cabec90cc3716d647e7d3c9396fcfa56cafcbfad.tar.bz2 vcxsrv-cabec90cc3716d647e7d3c9396fcfa56cafcbfad.zip |
X server is running again (at least via xdmcp)
Diffstat (limited to 'xorg-server/os')
-rw-r--r-- | xorg-server/os/utils.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c index 1f37b4d9b..2d73a0c2d 100644 --- a/xorg-server/os/utils.c +++ b/xorg-server/os/utils.c @@ -240,11 +240,7 @@ OsSignal(sig, handler) * server at a time. This keeps the servers from stomping on each other * if the user forgets to give them different display numbers. */ -#ifdef _MSC_VER -#define LOCK_DIR getenv("TEMP") -#else #define LOCK_DIR "/tmp" -#endif #define LOCK_TMP_PREFIX "/.tX" #define LOCK_PREFIX "/.X" #define LOCK_SUFFIX "-lock" @@ -260,12 +256,6 @@ OsSignal(sig, handler) #endif #endif -#ifdef _MSC_VER -#define kill(pid, exitcode) TerminateProcess(OpenProcess(PROCESS_TERMINATE ,FALSE,pid),exitcode) -#define link rename -#endif - - static Bool StillLocking = FALSE; static char szLockFile[PATH_MAX]; static Bool nolock = FALSE; @@ -279,19 +269,27 @@ static Bool nolock = FALSE; void LockServer(void) { +#if defined(WIN32) && !defined(__CYGWIN__) + char MutexName[100]; + sprintf(MutexName, "Global\\VcXsrv_Mutex_%d\n", getpid()); + if (!CreateMutex(NULL,TRUE,MutexName) || GetLastError()== ERROR_ALREADY_EXISTS) + { + FatalError("Server is already active for display %d\n", atoi(display)); + } +#else + char port[20]; char tmp[PATH_MAX], pid_str[12]; int lfd, i, haslock, l_pid, t; char *tmppath = NULL; int len; - char port[20]; if (nolock) return; /* * Path names */ tmppath = LOCK_DIR; - sprintf(port, "%d", atoi(display)); + len = strlen(LOCK_PREFIX) > strlen(LOCK_TMP_PREFIX) ? strlen(LOCK_PREFIX) : strlen(LOCK_TMP_PREFIX); len += strlen(tmppath) + strlen(port) + strlen(LOCK_SUFFIX) + 1; @@ -396,6 +394,7 @@ LockServer(void) if (!haslock) FatalError("Could not create server lock file: %s\n", szLockFile); StillLocking = FALSE; +#endif } /* |