aboutsummaryrefslogtreecommitdiff
path: root/libXau
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-04-08 08:20:47 +0200
committermarha <marha@users.sourceforge.net>2013-04-08 08:20:47 +0200
commita4505330e3469b6956348812ff2d6c24f812a8ba (patch)
treecf2b88c771188580ab585f763d2e7a0309ecab26 /libXau
parent44fb3db38c5148666f62c78e10fc37bb20ed5c5c (diff)
parent95fb19d661154ba8cfc6c793a0daa25657294b3b (diff)
downloadvcxsrv-a4505330e3469b6956348812ff2d6c24f812a8ba.tar.gz
vcxsrv-a4505330e3469b6956348812ff2d6c24f812a8ba.tar.bz2
vcxsrv-a4505330e3469b6956348812ff2d6c24f812a8ba.zip
Merge remote-tracking branch 'origin/released'
* origin/released: fontconfig libXau mesa xserver xkeyboard-config git update 8 Apr 2013
Diffstat (limited to 'libXau')
-rw-r--r--libXau/AuFileName.c7
-rw-r--r--libXau/AuGetAddr.c15
-rw-r--r--libXau/AuGetBest.c15
-rw-r--r--libXau/AuLock.c30
-rw-r--r--libXau/AuUnlock.c10
-rw-r--r--libXau/configure.ac4
6 files changed, 31 insertions, 50 deletions
diff --git a/libXau/AuFileName.c b/libXau/AuFileName.c
index 473fad110..090427387 100644
--- a/libXau/AuFileName.c
+++ b/libXau/AuFileName.c
@@ -57,9 +57,8 @@ XauFileName (void)
name = getenv ("HOME");
if (!name) {
#ifdef WIN32
- (void) strcpy (dir, "/users/");
if ((name = getenv("USERNAME"))) {
- (void) strcat (dir, name);
+ snprintf(dir, sizeof(dir), "/users/%s", name);
name = dir;
}
if (!name)
@@ -81,7 +80,7 @@ XauFileName (void)
bsize = size;
}
- strcpy (buf, name);
- strcat (buf, slashDotXauthority + (name[1] == '\0' ? 1 : 0));
+ snprintf (buf, bsize, "%s%s", name,
+ slashDotXauthority + (name[1] == '\0' ? 1 : 0));
return buf;
}
diff --git a/libXau/AuGetAddr.c b/libXau/AuGetAddr.c
index 897d8b565..6f5fe16e4 100644
--- a/libXau/AuGetAddr.c
+++ b/libXau/AuGetAddr.c
@@ -30,14 +30,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xauth.h>
#include <X11/Xos.h>
-static int
-binaryEqual (_Xconst char *a, _Xconst char *b, int len)
-{
- while (len--)
- if (*a++ != *b++)
- return 0;
- return 1;
-}
+#define binaryEqual(a, b, len) (memcmp(a, b, len) == 0)
Xauth *
XauGetAuthByAddr (
@@ -94,13 +87,13 @@ _Xconst char* name)
if ((family == FamilyWild || entry->family == FamilyWild ||
(entry->family == family &&
address_length == entry->address_length &&
- binaryEqual (entry->address, address, (int)address_length))) &&
+ binaryEqual (entry->address, address, address_length))) &&
(number_length == 0 || entry->number_length == 0 ||
(number_length == entry->number_length &&
- binaryEqual (entry->number, number, (int)number_length))) &&
+ binaryEqual (entry->number, number, number_length))) &&
(name_length == 0 || entry->name_length == 0 ||
(entry->name_length == name_length &&
- binaryEqual (entry->name, name, (int)name_length))))
+ binaryEqual (entry->name, name, name_length))))
break;
XauDisposeAuth (entry);
}
diff --git a/libXau/AuGetBest.c b/libXau/AuGetBest.c
index 673ee406a..5556559ca 100644
--- a/libXau/AuGetBest.c
+++ b/libXau/AuGetBest.c
@@ -38,14 +38,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xos_r.h>
#endif
-static int
-binaryEqual (_Xconst char *a, _Xconst char *b, int len)
-{
- while (len--)
- if (*a++ != *b++)
- return 0;
- return 1;
-}
+#define binaryEqual(a, b, len) (memcmp(a, b, len) == 0)
Xauth *
XauGetBestAuthByAddr (
@@ -129,17 +122,17 @@ XauGetBestAuthByAddr (
if ((family == FamilyWild || entry->family == FamilyWild ||
(entry->family == family &&
((address_length == entry->address_length &&
- binaryEqual (entry->address, address, (int)address_length))
+ binaryEqual (entry->address, address, address_length))
#ifdef hpux
|| (family == FamilyLocal &&
fully_qual_address_length == entry->address_length &&
binaryEqual (entry->address, fully_qual_address,
- (int) fully_qual_address_length))
+ fully_qual_address_length))
#endif
))) &&
(number_length == 0 || entry->number_length == 0 ||
(number_length == entry->number_length &&
- binaryEqual (entry->number, number, (int)number_length))))
+ binaryEqual (entry->number, number, number_length))))
{
if (best_type == 0)
{
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;
diff --git a/libXau/AuUnlock.c b/libXau/AuUnlock.c
index ddbe7db9e..b81724600 100644
--- a/libXau/AuUnlock.c
+++ b/libXau/AuUnlock.c
@@ -42,18 +42,16 @@ _Xconst char *file_name)
if (strlen (file_name) > 1022)
return 0;
#ifndef WIN32
- (void) strcpy (creat_name, file_name);
- (void) strcat (creat_name, "-c");
+ snprintf (creat_name, sizeof(creat_name), "%s-c", file_name);
#endif
- (void) strcpy (link_name, file_name);
- (void) strcat (link_name, "-l");
+ snprintf (link_name, sizeof(link_name), "%s-l", file_name);
/*
* I think this is the correct order
*/
#ifndef WIN32
- (void) unlink (creat_name);
+ (void) remove (creat_name);
#endif
- (void) unlink (link_name);
+ (void) remove (link_name);
return 1;
}
diff --git a/libXau/configure.ac b/libXau/configure.ac
index 62a4717f5..e55cfceb6 100644
--- a/libXau/configure.ac
+++ b/libXau/configure.ac
@@ -26,6 +26,7 @@ AC_INIT([libXau], [1.0.7],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXau])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
+AC_USE_SYSTEM_EXTENSIONS
# Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2])
@@ -43,6 +44,9 @@ XORG_DEFAULT_OPTIONS
# Checks for programs.
AC_PROG_LN_S
+# Checks for library functions.
+AC_CHECK_FUNCS([pathconf])
+
# Obtain compiler/linker options for depedencies
PKG_CHECK_MODULES(XAU, xproto)