Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/netbsd32 Initialise destination before performing...



details:   https://anonhg.NetBSD.org/src/rev/aba9b8ea73ae
branches:  trunk
changeset: 788800:aba9b8ea73ae
user:      njoly <njoly%NetBSD.org@localhost>
date:      Sat Jul 20 13:13:33 2013 +0000

description:
Initialise destination before performing stat structure conversion.
Avoid getting garbage for structure members not set explicitely.

diffstat:

 sys/compat/netbsd32/netbsd32_conv.h |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (33 lines):

diff -r 23fedf9cd8a7 -r aba9b8ea73ae sys/compat/netbsd32/netbsd32_conv.h
--- a/sys/compat/netbsd32/netbsd32_conv.h       Sat Jul 20 10:31:19 2013 +0000
+++ b/sys/compat/netbsd32/netbsd32_conv.h       Sat Jul 20 13:13:33 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_conv.h,v 1.26 2011/03/06 17:08:34 bouyer Exp $        */
+/*     $NetBSD: netbsd32_conv.h,v 1.27 2013/07/20 13:13:33 njoly Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -383,6 +383,7 @@
 static __inline void
 netbsd32_from___stat13(const struct stat *sbp, struct netbsd32_stat13 *sb32p)
 {
+       memset(sb32p, 0, sizeof(*sb32p));
        sb32p->st_dev = (uint32_t)sbp->st_dev;
        sb32p->st_ino = sbp->st_ino;
        sb32p->st_mode = sbp->st_mode;
@@ -408,6 +409,7 @@
 static __inline void
 netbsd32_from___stat50(const struct stat *sbp, struct netbsd32_stat50 *sb32p)
 {
+       memset(sb32p, 0, sizeof(*sb32p));
        sb32p->st_dev = (uint32_t)sbp->st_dev;
        sb32p->st_ino = sbp->st_ino;
        sb32p->st_mode = sbp->st_mode;
@@ -433,6 +435,7 @@
 static __inline void
 netbsd32_from_stat(const struct stat *sbp, struct netbsd32_stat *sb32p)
 {
+       memset(sb32p, 0, sizeof(*sb32p));
        sb32p->st_dev = sbp->st_dev;
        sb32p->st_ino = sbp->st_ino;
        sb32p->st_mode = sbp->st_mode;



Home | Main Index | Thread Index | Old Index