Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/am-utils fix aliasing issues and remove gcc hacks.



details:   https://anonhg.NetBSD.org/src/rev/b506a77dacf6
branches:  trunk
changeset: 768458:b506a77dacf6
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Aug 17 09:03:47 2011 +0000

description:
fix aliasing issues and remove gcc hacks.

diffstat:

 external/bsd/am-utils/bin/amd/Makefile   |  11 +----------
 external/bsd/am-utils/bin/amq/Makefile   |   7 +------
 external/bsd/am-utils/bin/hlfsd/Makefile |   7 +------
 external/bsd/am-utils/dist/hlfsd/stubs.c |  28 ++++++++++++++++------------
 4 files changed, 19 insertions(+), 34 deletions(-)

diffs (139 lines):

diff -r aa1898d010a3 -r b506a77dacf6 external/bsd/am-utils/bin/amd/Makefile
--- a/external/bsd/am-utils/bin/amd/Makefile    Wed Aug 17 08:31:27 2011 +0000
+++ b/external/bsd/am-utils/bin/amd/Makefile    Wed Aug 17 09:03:47 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.8 2011/06/22 02:49:42 mrg Exp $
+#      $NetBSD: Makefile,v 1.9 2011/08/17 09:03:47 christos Exp $
 
 .include "${.CURDIR}/../Makefile.inc"
 
@@ -44,10 +44,6 @@
 SRCS+= info_nis.c
 .endif
 
-.if defined(HAVE_GCC)
-COPTS.amq_subr.c+=     -fno-strict-aliasing
-.endif
-
 # the following are not supported on NetBSD
 #      info_ldap.c info_nisplus.c ops_cachefs.c ops_efs.c ops_lofs.c ops_xfs.c
 MAN+=  amd.8
@@ -83,8 +79,3 @@
 
 
 .include <bsd.prog.mk>
-
-# XXX
-.if ${HAVE_GCC} == 45
-COPTS.readdir.c+=      -fno-strict-aliasing
-.endif
diff -r aa1898d010a3 -r b506a77dacf6 external/bsd/am-utils/bin/amq/Makefile
--- a/external/bsd/am-utils/bin/amq/Makefile    Wed Aug 17 08:31:27 2011 +0000
+++ b/external/bsd/am-utils/bin/amq/Makefile    Wed Aug 17 09:03:47 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.3 2011/06/20 07:43:57 mrg Exp $
+#      $NetBSD: Makefile,v 1.4 2011/08/17 09:03:47 christos Exp $
 
 .include "${.CURDIR}/../Makefile.inc"
 
@@ -13,9 +13,4 @@
 CPPFLAGS+=     -I${DIST}
 LDADD+=                ${LIBAMU}
 
-.if defined(HAVE_GCC)
-COPTS.amq_xdr.c+=      -fno-strict-aliasing
-COPTS.amq.c+=          -fno-strict-aliasing
-.endif
-
 .include <bsd.prog.mk>
diff -r aa1898d010a3 -r b506a77dacf6 external/bsd/am-utils/bin/hlfsd/Makefile
--- a/external/bsd/am-utils/bin/hlfsd/Makefile  Wed Aug 17 08:31:27 2011 +0000
+++ b/external/bsd/am-utils/bin/hlfsd/Makefile  Wed Aug 17 09:03:47 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.2 2011/06/22 02:49:42 mrg Exp $
+#      $NetBSD: Makefile,v 1.3 2011/08/17 09:03:47 christos Exp $
 
 .include "${.CURDIR}/../Makefile.inc"
 
@@ -14,8 +14,3 @@
 LDADD+=                ${LIBAMU} -lrpcsvc
 
 .include <bsd.prog.mk>
-
-# XXX
-.if ${HAVE_GCC} == 45
-COPTS.stubs.c+=        -fno-strict-aliasing
-.endif
diff -r aa1898d010a3 -r b506a77dacf6 external/bsd/am-utils/dist/hlfsd/stubs.c
--- a/external/bsd/am-utils/dist/hlfsd/stubs.c  Wed Aug 17 08:31:27 2011 +0000
+++ b/external/bsd/am-utils/dist/hlfsd/stubs.c  Wed Aug 17 09:03:47 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: stubs.c,v 1.1.1.2 2009/03/20 20:26:55 christos Exp $   */
+/*     $NetBSD: stubs.c,v 1.2 2011/08/17 09:03:47 christos Exp $       */
 
 /*
  * Copyright (c) 1997-2009 Erez Zadok
@@ -166,8 +166,9 @@
     if (gid != hlfs_gid) {
       res.ns_status = NFSERR_STALE;
     } else {
-      memset((char *) &uid, 0, sizeof(int));
-      uid = *(u_int *) argp->fh_data;
+      u_int xuid;
+      memcpy(&xuid, argp->fh_data, sizeof(xuid));
+      uid = xuid;
       if (plt_search(uid) != (uid2home_t *) NULL) {
        res.ns_status = NFS_OK;
        un_fattr.na_fileid = uid;
@@ -282,13 +283,15 @@
       res.dr_status = NFSERR_NOENT;
       return &res;
     } else {                   /* entry found and gid is permitted */
+      u_int xuid;
       un_fattr.na_fileid = untab[idx].uid;
       res.dr_u.dr_drok_u.drok_attributes = un_fattr;
-      memset((char *) &un_fhandle, 0, sizeof(am_nfs_fh));
-      *(u_int *) un_fhandle.fh_data = (u_int) untab[idx].uid;
-      xstrlcpy((char *) &un_fhandle.fh_data[sizeof(int)],
+      memset(&un_fhandle, 0, sizeof(am_nfs_fh));
+      xuid = (u_int) untab[idx].uid;
+      memcpy(un_fhandle.fh_data, &xuid, sizeof(xuid));
+      xstrlcpy((char *) &un_fhandle.fh_data[sizeof(xuid)],
               untab[idx].username,
-              sizeof(am_nfs_fh) - sizeof(int));
+              sizeof(am_nfs_fh) - sizeof(xuid));
       res.dr_u.dr_drok_u.drok_fhandle = un_fhandle;
       res.dr_status = NFS_OK;
       dlog("nfs_lookup: successful lookup for uid=%ld, gid=%ld: username=%s",
@@ -309,7 +312,7 @@
   uid_t userid = (uid_t) INVALIDID;
   gid_t groupid = hlfs_gid + 1;        /* anything not hlfs_gid */
   int retval = 0;
-  char *path_val = (char *) NULL;
+  char *path_val = NULL;
   char *username;
   static uid_t last_uid = (uid_t) INVALIDID;
 
@@ -330,7 +333,7 @@
        * processing, by getting a NULL returned as a
        * "special".  Child returns result.
        */
-      return (nfsreadlinkres *) NULL;
+      return NULL;
     }
 
   } else {                     /* check if asked for user mailbox */
@@ -340,9 +343,10 @@
     }
 
     if (groupid == hlfs_gid) {
-      memset((char *) &userid, 0, sizeof(int));
-      userid = *(u_int *) argp->fh_data;
-      username = (char *) &argp->fh_data[sizeof(int)];
+      u_int xuserid;
+      memcpy(&xuserid, argp->fh_data, sizeof(xuserid));
+      userid = xuserid;
+      username = (char *) &argp->fh_data[sizeof(xuserid)];
       if (!(res.rlr_u.rlr_data_u = mailbox(userid, username)))
        return (nfsreadlinkres *) NULL;
     } else {



Home | Main Index | Thread Index | Old Index