Source-Changes-HG archive

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

[src/trunk]: src/sys/nfs nfsrv_create: fix an LP64 problem for exclusive create.



details:   https://anonhg.NetBSD.org/src/rev/bedea8361c9d
branches:  trunk
changeset: 567078:bedea8361c9d
user:      yamt <yamt%NetBSD.org@localhost>
date:      Mon May 31 08:47:08 2004 +0000

description:
nfsrv_create: fix an LP64 problem for exclusive create.

diffstat:

 sys/nfs/nfs_serv.c |  25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)

diffs (53 lines):

diff -r 6e8eeaf09ef9 -r bedea8361c9d sys/nfs/nfs_serv.c
--- a/sys/nfs/nfs_serv.c        Mon May 31 06:51:59 2004 +0000
+++ b/sys/nfs/nfs_serv.c        Mon May 31 08:47:08 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_serv.c,v 1.88 2004/04/21 01:05:42 christos Exp $   */
+/*     $NetBSD: nfs_serv.c,v 1.89 2004/05/31 08:47:08 yamt Exp $       */
 
 /*
  * Copyright (c) 1989, 1993
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.88 2004/04/21 01:05:42 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.89 2004/05/31 08:47:08 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1477,8 +1477,12 @@
                                if (exclusive_flag) {
                                        exclusive_flag = 0;
                                        VATTR_NULL(&va);
-                                       memcpy((caddr_t)&va.va_atime, cverf,
-                                               NFSX_V3CREATEVERF);
+                                       /*
+                                        * XXX
+                                        * assuming NFSX_V3CREATEVERF
+                                        * == sizeof(nfstime3)
+                                        */
+                                       fxdr_nfsv3time(cverf, &va.va_atime);
                                        error = VOP_SETATTR(nd.ni_vp, &va, cred,
                                                procp);
                                }
@@ -1546,9 +1550,16 @@
                vput(vp);
        }
        if (v3) {
-               if (exclusive_flag && !error &&
-                       memcmp(cverf, (caddr_t)&va.va_atime, NFSX_V3CREATEVERF))
-                       error = EEXIST;
+               if (exclusive_flag && !error) {
+                       /*
+                        * XXX assuming NFSX_V3CREATEVERF == sizeof(nfstime3)
+                        */
+                       char oldverf[NFSX_V3CREATEVERF];
+
+                       txdr_nfsv3time(&va.va_atime, oldverf);
+                       if (memcmp(cverf, oldverf, NFSX_V3CREATEVERF))
+                               error = EEXIST;
+               }
                diraft_ret = VOP_GETATTR(dirp, &diraft, cred, procp);
                vrele(dirp);
        }



Home | Main Index | Thread Index | Old Index