commit-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_3-5-g9380f89


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_3-5-g9380f89
Date: Sat, 23 May 2015 09:56:12 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  9380f89f7e01806b80858f5979d1417fa11ec7e4 (commit)
      from  c2fb48d7c9260e6dd6a90133b5e19f44735db344 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=9380f89f7e01806b80858f5979d1417fa11ec7e4


commit 9380f89f7e01806b80858f5979d1417fa11ec7e4
Author: Guillem Jover <address@hidden>
Date:   Fri May 22 11:42:59 2015 +0200

    libls: Alignment issue on sparc systems.
    
    Force alignment when allocating file stat data.
    Sparc systems are sensitive to misalignment.

diff --git a/ChangeLog b/ChangeLog
index 3f73476..fe9b91a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2015-05-22  Guillem Jover  <address@hidden>
+
+       libls: Alignment issue on sparc systems.
+       The test suite executed by Debian's build daemon
+       uncovered a failure on sparc due to incomplete
+       alignment on word boundaries.
+
+       * libls/fts.c (ALIGNBYTES, ALIGN): New macros.
+       (fts_alloc): Add ALIGNBYTES to the size being allocated
+       to P, a structure FTSENT.  Then compose the assignment of
+       `P->fts_statp' with macro ALIGN to force correct alignment
+       for the pointer to `struct stat'.
+
 2015-05-19  Mats Erik Andersson  <address@hidden>
 
        ifconfig: Fix BSD-specific interface access.
diff --git a/libls/fts.c b/libls/fts.c
index d1ccef2..83eab1a 100644
--- a/libls/fts.c
+++ b/libls/fts.c
@@ -59,6 +59,19 @@
 
 #include "fts.h"
 
+/* Largest alignment size needed, minus one.
+ * It is used as value and as bit mask.
+ * Usually long double is the worst case.  */
+#ifndef ALIGNBYTES
+# define ALIGNBYTES    (__alignof__ (long double) - 1)
+#endif
+
+/* Align P to size ALIGNBYTES at adapted boundary.  */
+#ifndef ALIGN
+# define ALIGN(p)      (((unsigned long int) (p) + ALIGNBYTES) & ~ALIGNBYTES)
+#endif
+
+
 static FTSENT *fts_alloc (FTS *, const char *, int);
 static FTSENT *fts_build (FTS *, int);
 static void fts_lfree (FTSENT *);
@@ -1000,7 +1013,7 @@ fts_alloc (FTS *sp, const char *name, register int 
namelen)
    */
   len = sizeof (FTSENT) + namelen;
   if (!ISSET (FTS_NOSTAT))
-    len += sizeof (struct stat);
+    len += sizeof (struct stat) + ALIGNBYTES;
   if ((p = malloc (len)) == NULL)
     return (NULL);
 
@@ -1008,7 +1021,7 @@ fts_alloc (FTS *sp, const char *name, register int 
namelen)
   memmove (p->fts_name, name, namelen + 1);
 
   if (!ISSET (FTS_NOSTAT))
-    p->fts_statp = (struct stat *) (p->fts_name + namelen + 2);
+    p->fts_statp = (struct stat *) ALIGN (p->fts_name + namelen + 2);
   p->fts_namelen = namelen;
   p->fts_path = sp->fts_path;
   p->fts_errno = 0;

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog   |   13 +++++++++++++
 libls/fts.c |   17 +++++++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]