Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/librump/rumpvfs Get better results if initialize a ...



details:   https://anonhg.NetBSD.org/src/rev/128ce0f1585b
branches:  trunk
changeset: 754434:128ce0f1585b
user:      pooka <pooka%NetBSD.org@localhost>
date:      Fri Apr 30 09:44:38 2010 +0000

description:
Get better results if initialize a field before calling strlen().
(can't believe that worked last night.  the stars must've been in
the "lottery, stupid" position)

diffstat:

 sys/rump/librump/rumpvfs/rumpfs.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 1086b7b16869 -r 128ce0f1585b sys/rump/librump/rumpvfs/rumpfs.c
--- a/sys/rump/librump/rumpvfs/rumpfs.c Fri Apr 30 09:41:59 2010 +0000
+++ b/sys/rump/librump/rumpvfs/rumpfs.c Fri Apr 30 09:44:38 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpfs.c,v 1.44 2010/04/29 22:45:40 pooka Exp $        */
+/*     $NetBSD: rumpfs.c,v 1.45 2010/04/30 09:44:38 pooka Exp $        */
 
 /*
  * Copyright (c) 2009  Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.44 2010/04/29 22:45:40 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.45 2010/04/30 09:44:38 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -810,8 +810,8 @@
                struct dirent dent;
 
                dent.d_fileno = rdent->rd_node->rn_va.va_fileid;
+               strlcpy(dent.d_name, rdent->rd_name, sizeof(dent.d_name));
                dent.d_namlen = strlen(dent.d_name);
-               strcpy(dent.d_name, rdent->rd_name);
                dent.d_type = vdmap[rdent->rd_node->rn_va.va_type];
                dent.d_reclen = _DIRENT_RECLEN(&dent, dent.d_namlen);
 



Home | Main Index | Thread Index | Old Index