Source-Changes-HG archive

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

[src/trunk]: src/sbin/mount_nfs switch from an ugly cast and ntohl() usage to...



details:   https://anonhg.NetBSD.org/src/rev/7d69c633551e
branches:  trunk
changeset: 766992:7d69c633551e
user:      mrg <mrg%NetBSD.org@localhost>
date:      Wed Jul 06 09:02:54 2011 +0000

description:
switch from an ugly cast and ntohl() usage to be32dec().  use sizeof.
idea from dh, and fixes a GCC 4.5 warning.

diffstat:

 sbin/mount_nfs/getnfsargs_small.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r c50d2ac6b775 -r 7d69c633551e sbin/mount_nfs/getnfsargs_small.c
--- a/sbin/mount_nfs/getnfsargs_small.c Wed Jul 06 09:01:35 2011 +0000
+++ b/sbin/mount_nfs/getnfsargs_small.c Wed Jul 06 09:02:54 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getnfsargs_small.c,v 1.8 2008/04/29 06:53:01 martin Exp $      */
+/*     $NetBSD: getnfsargs_small.c,v 1.9 2011/07/06 09:02:54 mrg Exp $ */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: getnfsargs_small.c,v 1.8 2008/04/29 06:53:01 martin Exp $");
+__RCSID("$NetBSD: getnfsargs_small.c,v 1.9 2011/07/06 09:02:54 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/mount.h>
@@ -248,8 +248,8 @@
 
        nfsargsp->fh = nfhret.nfh;
        if (nfsvers == NFS_VER3) {
-               nfsargsp->fhsize = ntohl(*(uint32_t *)nfhret.nfh);
-               nfsargsp->fh += 4;
+               nfsargsp->fhsize = be32dec(nfhret.nfh);
+               nfsargsp->fh += sizeof(uint32_t);
        } else {
                nfsargsp->fhsize = NFSX_V2FH;
                nfsargsp->flags &= ~NFSMNT_NFSV3;



Home | Main Index | Thread Index | Old Index