AuFileName.c | 30 ++++++++++++++++++++++-------- AuGetAddr.c | 15 ++++----------- AuGetBest.c | 15 ++++----------- AuLock.c | 33 ++++++++++++--------------------- AuRead.c | 4 ++-- AuUnlock.c | 10 ++++------ AuWrite.c | 4 ++-- Makefile.am | 3 +-- autogen.sh | 4 +++- configure.ac | 7 +++++-- include/X11/Xauth.h | 12 ++++++++++++ man/Xau.man | 50 ++++++++++++++++++++++++-------------------------- 12 files changed, 95 insertions(+), 92 deletions(-)
New commits: commit 899790011304c4029e15abf410e49ce7cec17e0a Author: Alan Coopersmith <alan.coopersm...@oracle.com> Date: Fri May 24 15:04:00 2013 -0700 libXau 1.0.8 Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> diff --git a/configure.ac b/configure.ac index e55cfce..7f914ea 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([libXau], [1.0.7], +AC_INIT([libXau], [1.0.8], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXau]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) commit f5a57d8a21a34d7084cce294e24c0422e02ef8ef Author: Alan Coopersmith <alan.coopersm...@oracle.com> Date: Sat Mar 30 11:42:09 2013 -0700 Use remove() instead of unlink() to delete lock files In normal cases, no difference. If someone has accidentally created a directory with those names, this can save you from needing to fsck to clean it up on some filesystems (like UFS). Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> diff --git a/AuLock.c b/AuLock.c index ce15f25..5dfc174 100644 --- a/AuLock.c +++ b/AuLock.c @@ -64,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); } } diff --git a/AuUnlock.c b/AuUnlock.c index 309ba6d..b817246 100644 --- a/AuUnlock.c +++ b/AuUnlock.c @@ -49,9 +49,9 @@ _Xconst char *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; } commit 4352cf9707df08d51ef891be156d475743d0a060 Author: Alan Coopersmith <alan.coopersm...@oracle.com> Date: Sat Mar 30 11:30:37 2013 -0700 Call memcmp() instead of defining our own equivalent Stops casting len parameters to int in callers so that this change doesn't introduce warnings that we're taking unsigned values, casting them to signed, then passing to a function that wants them unsigned. Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> diff --git a/AuGetAddr.c b/AuGetAddr.c index 897d8b5..6f5fe16 100644 --- a/AuGetAddr.c +++ b/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/AuGetBest.c b/AuGetBest.c index 673ee40..5556559 100644 --- a/AuGetBest.c +++ b/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) { commit 704beb71768cdaa2448da6edfa219b4a7bf862f1 Author: Alan Coopersmith <alan.coopersm...@oracle.com> Date: Sat Mar 30 11:18:44 2013 -0700 Replace strcpy+strcat pairs with snprintf calls Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> diff --git a/AuFileName.c b/AuFileName.c index 473fad1..0904273 100644 --- a/AuFileName.c +++ b/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/AuLock.c b/AuLock.c index b9859f1..ce15f25 100644 --- a/AuLock.c +++ b/AuLock.c @@ -55,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); /* diff --git a/AuUnlock.c b/AuUnlock.c index ddbe7db..309ba6d 100644 --- a/AuUnlock.c +++ b/AuUnlock.c @@ -42,11 +42,9 @@ _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 */ commit 3038a87edce31ad2895431f7cfdc96a33fc70e02 Author: Alan Coopersmith <alan.coopersm...@oracle.com> Date: Sat Mar 30 10:59:06 2013 -0700 Check for configure's HAVE_UNISTD_H instead of X_NOT_POSIX Drops fallback prototype of sleep() for non-POSIX, non-Windows systems Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> diff --git a/AuLock.c b/AuLock.c index 3ae7596..b9859f1 100644 --- a/AuLock.c +++ b/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 commit 325f5282bc1d93b72b0b05037245cf130970fa38 Author: Alan Coopersmith <alan.coopersm...@oracle.com> Date: Sat Mar 30 10:55:26 2013 -0700 Use configure check for pathconf instead of X_NOT_POSIX #define Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> diff --git a/AuLock.c b/AuLock.c index 7bf9e5d..3ae7596 100644 --- a/AuLock.c +++ b/AuLock.c @@ -84,7 +84,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 +93,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 +104,7 @@ long dead) } if (errno != EEXIST) return LOCK_ERROR; -#ifndef X_NOT_POSIX } -#endif } (void) sleep ((unsigned) timeout); --retries; diff --git a/configure.ac b/configure.ac index 62a4717..e55cfce 100644 --- a/configure.ac +++ b/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) commit 1a8a1b2c68967b48c07b56142799b1020f017027 Author: Colin Walters <walt...@verbum.org> Date: Wed Jan 4 17:37:06 2012 -0500 autogen.sh: Implement GNOME Build API http://people.gnome.org/~walters/docs/build-api.txt Signed-off-by: Adam Jackson <a...@redhat.com> diff --git a/autogen.sh b/autogen.sh index 904cd67..fc34bd5 100755 --- a/autogen.sh +++ b/autogen.sh @@ -9,4 +9,6 @@ cd $srcdir autoreconf -v --install || exit 1 cd $ORIGDIR || exit $? -$srcdir/configure --enable-maintainer-mode "$@" +if test -z "$NOCONFIGURE"; then + $srcdir/configure "$@" +fi commit b1ace13d5864080f2101f2910cad706f800984de Author: Adam Jackson <a...@redhat.com> Date: Tue Jan 15 14:28:48 2013 -0500 configure: Remove AM_MAINTAINER_MODE Signed-off-by: Adam Jackson <a...@redhat.com> diff --git a/configure.ac b/configure.ac index 92ad113..62a4717 100644 --- a/configure.ac +++ b/configure.ac @@ -29,7 +29,6 @@ AC_CONFIG_HEADERS([config.h]) # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) -AM_MAINTAINER_MODE # Initialize libtool AC_LIBTOOL_WIN32_DLL commit 8570d287396934f26224c76d48d7f17d87380e72 Author: Alan Coopersmith <alan.coopersm...@oracle.com> Date: Sat Jan 12 15:58:59 2013 -0800 Convert INCLUDES to AM_CPPFLAGS in preparation for automake-1.14 obsoletion Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> diff --git a/Makefile.am b/Makefile.am index 9e8d95b..1049614 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,8 +3,7 @@ SUBDIRS=man lib_LTLIBRARIES = libXau.la AM_CFLAGS = $(XAU_CFLAGS) $(CWARNFLAGS) - -INCLUDES = -I${top_srcdir}/include +AM_CPPFLAGS = -I${top_srcdir}/include libXau_la_LDFLAGS = -version-number 6:0:0 -no-undefined commit 369d133ca19f938d123254dee5c88214512f82df Author: Alan Coopersmith <alan.coopersm...@oracle.com> Date: Fri Jan 4 19:38:51 2013 -0800 unifdef -U__UNIXOS2__ Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> diff --git a/AuLock.c b/AuLock.c index a816b24..7bf9e5d 100644 --- a/AuLock.c +++ b/AuLock.c @@ -43,9 +43,6 @@ extern unsigned sleep (); #define link rename #endif #endif -#ifdef __UNIXOS2__ -#define link rename -#endif int XauLockAuth ( commit e04364efccbb3bb4cfc5f4cb491ffa1faaaacbdb Author: Alan Coopersmith <alan.coopersm...@oracle.com> Date: Sun Dec 16 15:50:52 2012 -0800 Tell clang to shut up about the padding in struct xauth We can't clean it up without breaking ABI, so disable the warnings for it: ./include/X11/Xauth.h:33:19: warning: padding struct 'struct xauth' with 4 bytes to align 'address' [-Wpadded] char *address; ^ ./include/X11/Xauth.h:35:19: warning: padding struct 'struct xauth' with 6 bytes to align 'number' [-Wpadded] char *number; ^ ./include/X11/Xauth.h:37:19: warning: padding struct 'struct xauth' with 6 bytes to align 'name' [-Wpadded] char *name; ^ ./include/X11/Xauth.h:39:18: warning: padding struct 'struct xauth' with 6 bytes to align 'data' [-Wpadded] char *data; ^ Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/include/X11/Xauth.h b/include/X11/Xauth.h index f57a1b3..a707bed 100644 --- a/include/X11/Xauth.h +++ b/include/X11/Xauth.h @@ -27,6 +27,14 @@ in this Software without prior written authorization from The Open Group. #ifndef _Xauth_h #define _Xauth_h +/* struct xauth is full of implicit padding to properly align the pointers + after the length fields. We can't clean that up without breaking ABI, + so tell clang not to bother complaining about it. */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + typedef struct xauth { unsigned short family; unsigned short address_length; @@ -39,6 +47,10 @@ typedef struct xauth { char *data; } Xauth; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + #ifndef _XAUTH_STRUCT_ONLY # include <X11/Xfuncproto.h> commit 4d43b4554f8e35bf8122ae9d2f1bbc0e56fe6d37 Author: Alan Coopersmith <alan.coopersm...@oracle.com> Date: Sun Dec 16 15:40:30 2012 -0800 Clean up some clang warnings about sign conversion fread & fwrite are defined as taking size_t arguments (an unsigned type), so stop casting their arguments to a signed int just to confuse things. Fixes warnings: AuFileName.c:69:59: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] size = strlen (name) + strlen(&slashDotXauthority[1]) + 2; ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ AuRead.c:58:44: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion] if (fread (data, (int) sizeof (char), (int) len, file) != len) { ~~~~~ ^~~~~~~~~ AuWrite.c:49:46: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion] if (fwrite (string, (int) sizeof (char), (int) count, file) != count) ~~~~~~ ^~~~~~~~~~~ Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/AuFileName.c b/AuFileName.c index bc7b177..473fad1 100644 --- a/AuFileName.c +++ b/AuFileName.c @@ -45,12 +45,12 @@ XauFileName (void) { const char *slashDotXauthority = "/.Xauthority"; char *name; - static int bsize; + static size_t bsize; static int atexit_registered = 0; #ifdef WIN32 char dir[128]; #endif - int size; + size_t size; if ((name = getenv ("XAUTHORITY"))) return name; @@ -70,7 +70,7 @@ XauFileName (void) if (size > bsize) { if (buf) free (buf); - buf = malloc ((unsigned) size); + buf = malloc (size); if (!buf) return NULL; diff --git a/AuRead.c b/AuRead.c index 3c59632..5d41f03 100644 --- a/AuRead.c +++ b/AuRead.c @@ -35,7 +35,7 @@ read_short (unsigned short *shortp, FILE *file) { unsigned char file_short[2]; - if (fread ((char *) file_short, (int) sizeof (file_short), 1, file) != 1) + if (fread ((char *) file_short, sizeof (file_short), 1, file) != 1) return 0; *shortp = file_short[0] * 256 + file_short[1]; return 1; @@ -55,7 +55,7 @@ read_counted_string (unsigned short *countp, char **stringp, FILE *file) data = malloc ((unsigned) len); if (!data) return 0; - if (fread (data, (int) sizeof (char), (int) len, file) != len) { + if (fread (data, sizeof (char), len, file) != len) { bzero (data, len); free (data); return 0; diff --git a/AuWrite.c b/AuWrite.c index 0924f8d..1eb38a3 100644 --- a/AuWrite.c +++ b/AuWrite.c @@ -36,7 +36,7 @@ write_short (unsigned short s, FILE *file) file_short[0] = (s & (unsigned)0xff00) >> 8; file_short[1] = s & 0xff; - if (fwrite ((char *) file_short, (int) sizeof (file_short), 1, file) != 1) + if (fwrite ((char *) file_short, sizeof (file_short), 1, file) != 1) return 0; return 1; } @@ -46,7 +46,7 @@ write_counted_string (unsigned short count, char *string, FILE *file) { if (write_short (count, file) == 0) return 0; - if (fwrite (string, (int) sizeof (char), (int) count, file) != count) + if (fwrite (string, sizeof (char), count, file) != count) return 0; return 1; } commit f2b24dd74614ce807cacf764c6eddd834feffc5a Author: Eric S. Raymond <e...@thyrsus.com> Date: Thu Aug 23 11:12:39 2012 -0400 Remove a use of tab stops. diff --git a/man/Xau.man b/man/Xau.man index 46d4a19..d1b6603 100644 --- a/man/Xau.man +++ b/man/Xau.man @@ -29,22 +29,21 @@ Xau library: XauFileName, XauReadAuth, XauLockAuth, XauUnlockAuth, XauWriteAuth, XauDisposeAuth, XauGetAuthByAddr, XauGetBestAuthByAddr \- X authority database routines .SH SYNOPSIS -.B "#include <X11/Xauth.h>" -.PP +.ft CW .nf -.ta .5i 2i +#include <X11/Xauth.h> + typedef struct xauth { - unsigned short family; - unsigned short address_length; - char *address; - unsigned short number_length; - char *number; - unsigned short name_length; - char *name; - unsigned short data_length; - char *data; + unsigned short family; + unsigned short address_length; + char *address; + unsigned short number_length; + char *number; + unsigned short name_length; + char *name; + unsigned short data_length; + char *data; } Xauth; - .HP char *XauFileName (void); .HP @@ -68,7 +67,8 @@ int XauLockAuth (const char *\fIfile_name\fP\^, int \fIretries\fP\^, int int XauUnlockAuth (const char *\fIfile_name\fP\^); .HP int XauDisposeAuth (Xauth *\fIauth\fP\^); -.ft R +.fi +.ft .SH DESCRIPTION .PP \fBXauFileName\fP generates the default authorization file name by first @@ -106,18 +106,16 @@ files to be removed. \fIXauLockAuth\fP makes \fIretries\fP attempts to create and link the file names, pausing \fItimeout\fP seconds between each attempt. \fIXauLockAuth\fP returns a collection of values depending on the results: -.nf -.ta .5i 2i - - LOCK_ERROR A system error occurred, either a file_name - which is too long, or an unexpected failure from - a system call. errno may prove useful. - - LOCK_TIMEOUT \fIretries\fP attempts failed - - LOCK_SUCCESS The lock succeeded. - -.fi +.TP +LOCK_ERROR +A system error occurred, either a file_name which is too long, or an +unexpected failure from a system call. errno may prove useful. +.TP +LOCK_TIMEOUT +\fIretries\fP attempts failed +.TP +LOCK_SUCCESS +The lock succeeded. .PP \fBXauUnlockAuth\fP undoes the work of \fIXauLockAuth\fP by unlinking both the ``-c'' and ``-l'' file names. commit 9daef33e32ba36c1f872691daeebbf98a73b4b25 Author: Chase Douglas <chase.doug...@canonical.com> Date: Fri Apr 20 14:16:07 2012 -0700 Free XauFileName() static buffer at exit XauFileName() may allocate and return a static buffer. The only way to ensure it is freed is to deallocate it when the program exits. Signed-off-by: Chase Douglas <chase.doug...@canonical.com> Reviewed-by: Alan Coopersmith <alan.coopersm...@oracle.com> diff --git a/AuFileName.c b/AuFileName.c index f384f75..bc7b177 100644 --- a/AuFileName.c +++ b/AuFileName.c @@ -31,13 +31,22 @@ in this Software without prior written authorization from The Open Group. #include <X11/Xos.h> #include <stdlib.h> +static char *buf = NULL; + +static void +free_filename_buffer(void) +{ + free(buf); + buf = NULL; +} + char * XauFileName (void) { const char *slashDotXauthority = "/.Xauthority"; char *name; - static char *buf; static int bsize; + static int atexit_registered = 0; #ifdef WIN32 char dir[128]; #endif @@ -64,6 +73,12 @@ XauFileName (void) buf = malloc ((unsigned) size); if (!buf) return NULL; + + if (!atexit_registered) { + atexit(free_filename_buffer); + atexit_registered = 1; + } + bsize = size; } strcpy (buf, name); -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/e1uncfx-0007fn...@vasks.debian.org