aboutsummaryrefslogtreecommitdiff
path: root/libXau/AuLock.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-04-08 08:17:23 +0200
committermarha <marha@users.sourceforge.net>2013-04-11 11:13:40 +0200
commit59038e048c4be1e69744b087ba31386e98141a8f (patch)
treeb91f0b662663be6f26e985b0c09a906cfad9ccc5 /libXau/AuLock.c
parentdde22e946ccfb0bd937224daf42403b80528c2a6 (diff)
downloadvcxsrv-59038e048c4be1e69744b087ba31386e98141a8f.tar.gz
vcxsrv-59038e048c4be1e69744b087ba31386e98141a8f.tar.bz2
vcxsrv-59038e048c4be1e69744b087ba31386e98141a8f.zip
fontconfig libXau mesa xserver xkeyboard-config git update 8 Apr 2013
xserver commit 8928f8fa0bb154ce437af703ff702016f0dcf127 xkeyboard-config commit e5c6729f3679fe87a703eb1d7ec1cf0a61814ca8 libXau commit f5a57d8a21a34d7084cce294e24c0422e02ef8ef fontconfig commit 18bf57c70aafcad031c0b43756b754dcaf6a756a mesa commit eff66bc9f855fff5c4f5f57f247254a97431e8ad
Diffstat (limited to 'libXau/AuLock.c')
-rw-r--r--libXau/AuLock.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/libXau/AuLock.c b/libXau/AuLock.c
index 7bf9e5d30..5dfc1747e 100644
--- a/libXau/AuLock.c
+++ b/libXau/AuLock.c
@@ -33,15 +33,12 @@ in this Software without prior written authorization from The Open Group.
#include <errno.h>
#include <time.h>
#define Time_t time_t
-#ifndef X_NOT_POSIX
-#include <unistd.h>
-#else
-#ifndef WIN32
-extern unsigned sleep ();
-#else
-#include <X11/Xwindows.h>
-#define link rename
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
#endif
+#ifdef WIN32
+# include <X11/Xwindows.h>
+# define link rename
#endif
int
@@ -58,10 +55,8 @@ long dead)
if (strlen (file_name) > 1022)
return LOCK_ERROR;
- (void) strcpy (creat_name, file_name);
- (void) strcat (creat_name, "-c");
- (void) strcpy (link_name, file_name);
- (void) strcat (link_name, "-l");
+ snprintf (creat_name, sizeof(creat_name), "%s-c", file_name);
+ snprintf (link_name, sizeof(link_name), "%s-l", file_name);
if (stat (creat_name, &statb) != -1) {
now = time ((Time_t *) 0);
/*
@@ -69,8 +64,8 @@ long dead)
* case a 0 deadtime to force lock removal
*/
if (dead == 0 || now - statb.st_ctime > dead) {
- (void) unlink (creat_name);
- (void) unlink (link_name);
+ (void) remove (creat_name);
+ (void) remove (link_name);
}
}
@@ -84,7 +79,7 @@ long dead)
(void) close (creat_fd);
}
if (creat_fd != -1) {
-#ifndef X_NOT_POSIX
+#ifdef HAVE_PATHCONF
/* The file system may not support hard links, and pathconf should tell us that. */
if (1 == pathconf(creat_name, _PC_LINK_MAX)) {
if (-1 == rename(creat_name, link_name)) {
@@ -93,8 +88,9 @@ long dead)
} else {
return LOCK_SUCCESS;
}
- } else {
+ } else
#endif
+ {
if (link (creat_name, link_name) != -1)
return LOCK_SUCCESS;
if (errno == ENOENT) {
@@ -103,9 +99,7 @@ long dead)
}
if (errno != EEXIST)
return LOCK_ERROR;
-#ifndef X_NOT_POSIX
}
-#endif
}
(void) sleep ((unsigned) timeout);
--retries;