summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2012-04-09 22:14:52 -0400
committerKristian Høgsberg <krh@bitplanet.net>2012-04-10 00:04:57 -0400
commite5cf7416695c2e9454d025df63dbaa2fb6d4e4c9 (patch)
treec9ca7253a6af23dfcbe16751406f8e851e79ea94
parent2c76be7c1b26e22cfda63e39786f277ae53e459e (diff)
xserver: Return EEXIST if unlinking lockfile fails
Otherwise we'll keep trying to unlink it.
-rw-r--r--src/xserver-launcher.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/xserver-launcher.c b/src/xserver-launcher.c
index d3657c82..88ceb0c4 100644
--- a/src/xserver-launcher.c
+++ b/src/xserver-launcher.c
@@ -1654,9 +1654,13 @@ create_lockfile(int display, char *lockfile, size_t lsize)
/* stale lock file; unlink and try again */
fprintf(stderr,
"unlinking stale lock file %s\n", lockfile);
- unlink(lockfile);
- errno = EAGAIN;
close(fd);
+ if (unlink(lockfile))
+ /* If we fail to unlink, return EEXIST
+ so we try the next display number.*/
+ errno = EEXIST;
+ else
+ errno = EAGAIN;
return -1;
}