From: Kristian Høgsberg Date: Tue, 10 Apr 2012 02:14:52 +0000 (-0400) Subject: xserver: Return EEXIST if unlinking lockfile fails X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e5cf7416695c2e9454d025df63dbaa2fb6d4e4c9;p=profile%2Fivi%2Fweston-ivi-shell.git xserver: Return EEXIST if unlinking lockfile fails Otherwise we'll keep trying to unlink it. --- diff --git a/src/xserver-launcher.c b/src/xserver-launcher.c index d3657c8..88ceb0c 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; }