xserver: Return EEXIST if unlinking lockfile fails

Otherwise we'll keep trying to unlink it.
This commit is contained in:
Kristian Høgsberg 2012-04-09 22:14:52 -04:00
parent 2c76be7c1b
commit e5cf741669

View File

@ -1654,9 +1654,13 @@ create_lockfile(int display, char *lockfile, size_t lsize)
/* stale lock file; unlink and try again */ /* stale lock file; unlink and try again */
fprintf(stderr, fprintf(stderr,
"unlinking stale lock file %s\n", lockfile); "unlinking stale lock file %s\n", lockfile);
unlink(lockfile);
errno = EAGAIN;
close(fd); 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; return -1;
} }