Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/smbfs don't assume struct smbnode -> n_name is zero t...



details:   https://anonhg.NetBSD.org/src/rev/d6832068a370
branches:  trunk
changeset: 543247:d6832068a370
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Thu Feb 20 15:35:55 2003 +0000

description:
don't assume struct smbnode -> n_name is zero terminated,
use .*s to print it

diffstat:

 sys/fs/smbfs/smbfs_io.c    |   4 ++--
 sys/fs/smbfs/smbfs_vnops.c |  20 ++++++++++++--------
 2 files changed, 14 insertions(+), 10 deletions(-)

diffs (80 lines):

diff -r a36f4104f1fe -r d6832068a370 sys/fs/smbfs/smbfs_io.c
--- a/sys/fs/smbfs/smbfs_io.c   Thu Feb 20 15:34:42 2003 +0000
+++ b/sys/fs/smbfs/smbfs_io.c   Thu Feb 20 15:35:55 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: smbfs_io.c,v 1.2 2002/01/09 17:43:28 deberg Exp $      */
+/*     $NetBSD: smbfs_io.c,v 1.3 2003/02/20 15:35:55 jdolecek Exp $    */
 
 /*
  * Copyright (c) 2000-2001, Boris Popov
@@ -106,7 +106,7 @@
        long offset, limit;
 
        np = VTOSMB(vp);
-       SMBVDEBUG("dirname='%s'\n", np->n_name);
+       SMBVDEBUG("dirname='%.*s'\n", (int) np->n_nmlen, np->n_name);
        smb_makescred(&scred, uio->uio_procp, cred);
        offset = uio->uio_offset / DE_SIZE;     /* offset in the directory */
        limit = uio->uio_resid / DE_SIZE;
diff -r a36f4104f1fe -r d6832068a370 sys/fs/smbfs/smbfs_vnops.c
--- a/sys/fs/smbfs/smbfs_vnops.c        Thu Feb 20 15:34:42 2003 +0000
+++ b/sys/fs/smbfs/smbfs_vnops.c        Thu Feb 20 15:35:55 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: smbfs_vnops.c,v 1.5 2003/02/19 13:51:25 jdolecek Exp $ */
+/*     $NetBSD: smbfs_vnops.c,v 1.6 2003/02/20 15:35:55 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -265,7 +265,7 @@
        int mode = ap->a_mode;
        int error, accmode;
 
-       SMBVDEBUG("%s,%d\n", np->n_name, np->n_opencount);
+       SMBVDEBUG("%.*s,%d\n", (int) np->n_nmlen, np->n_name, np->n_opencount);
        if (vp->v_type != VREG && vp->v_type != VDIR) { 
                SMBFSERR("open eacces vtype=%d\n", vp->v_type);
                return EACCES;
@@ -324,7 +324,8 @@
        struct vattr vattr;
        int error;
 
-       SMBVDEBUG("name=%s, pid=%d, c=%d\n",np->n_name, td->td_pid, np->n_opencount);
+       SMBVDEBUG("name=%.*s, pid=%d, c=%d\n",
+               (int)np->n_nmlen, np->n_name, p->p_pid, np->n_opencount);
 
        smb_makescred(&scred, p, ap->a_cred);
 
@@ -399,7 +400,9 @@
        u_int32_t oldsize;
        int error;
 
-       SMBVDEBUG("%lx: '%s' %d\n", (long)vp, np->n_name, (vp->v_flag & VROOT) != 0);
+       SMBVDEBUG("%lx: '%.*s' %d\n", (long)vp,
+               (int) np->n_nmlen, np->n_name, (vp->v_flag & VROOT) != 0);
+
        if ((error = smbfs_attr_cachelookup(vp, va)) == 0)
                return (0);
 
@@ -912,8 +915,9 @@
        struct vnode *vp = ap->a_vp;
        struct smbnode *np = VTOSMB(vp);
 
-       printf("tag VT_SMBFS, name = %s, parent = %p, opencount = %d",
-           np->n_name, np->n_parent ? SMBTOV(np->n_parent) : NULL,
+       printf("tag VT_SMBFS, name = %.*s, parent = %p, opencount = %d",
+           (int)np->n_nmlen, np->n_name,
+           np->n_parent ? SMBTOV(np->n_parent) : NULL,
            np->n_opencount);
        lockmgr_printinfo(&vp->v_lock);
        printf("\n");
@@ -1219,8 +1223,8 @@
                return (EROFS);
 
 #ifdef SMB_VNODE_DEBUG
-       SMBVDEBUG("%d '%.*s' in '%s' id=d\n", nameiop, nmlen, name, 
-                       VTOSMB(dvp)->n_name);
+       SMBVDEBUG("%d '%.*s' in '%.*s' id=d\n", nameiop, nmlen, name, 
+           (int) VTOSMB(dvp)->n_nmlen, VTOSMB(dvp)->n_name);
 #endif
 
        /*



Home | Main Index | Thread Index | Old Index