Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/v7fs v7fs_getattr: adjust size of symlinks by -1 to c...



details:   https://anonhg.NetBSD.org/src/rev/72cf345e47e5
branches:  trunk
changeset: 335182:72cf345e47e5
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Dec 29 15:28:08 2014 +0000

description:
v7fs_getattr: adjust size of symlinks by -1 to compensate the trailing NUL.

Should fix the v7fs part of PR kern/48864.

diffstat:

 sys/fs/v7fs/v7fs_vnops.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r f83c379244c5 -r 72cf345e47e5 sys/fs/v7fs/v7fs_vnops.c
--- a/sys/fs/v7fs/v7fs_vnops.c  Mon Dec 29 14:43:06 2014 +0000
+++ b/sys/fs/v7fs/v7fs_vnops.c  Mon Dec 29 15:28:08 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: v7fs_vnops.c,v 1.17 2014/08/08 19:15:33 gson Exp $     */
+/*     $NetBSD: v7fs_vnops.c,v 1.18 2014/12/29 15:28:08 hannken Exp $  */
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: v7fs_vnops.c,v 1.17 2014/08/08 19:15:33 gson Exp $");
+__KERNEL_RCSID(0, "$NetBSD: v7fs_vnops.c,v 1.18 2014/12/29 15:28:08 hannken Exp $");
 #if defined _KERNEL_OPT
 #include "opt_v7fs.h"
 #endif
@@ -421,6 +421,11 @@
        vap->va_fsid = v7fsmount->devvp->v_rdev;
        vap->va_fileid = inode->inode_number;
        vap->va_size = vp->v_size;
+       if (vp->v_type == VLNK) {
+               /* Ajust for trailing NUL. */
+               KASSERT(vap->va_size > 0);
+               vap->va_size -= 1;
+       }
        vap->va_atime.tv_sec = inode->atime;
        vap->va_mtime.tv_sec = inode->mtime;
        vap->va_ctime.tv_sec = inode->ctime;



Home | Main Index | Thread Index | Old Index