Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ffs Inititalize the fs variable struct a little earl...



details:   https://anonhg.NetBSD.org/src/rev/548de162f3fa
branches:  trunk
changeset: 483704:548de162f3fa
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Thu Mar 16 10:37:00 2000 +0000

description:
Inititalize the fs variable struct a little earlier to avoid referencing
a bad pointer in a printf. Problem reported by Krister Walfridsson.

diffstat:

 sys/ufs/ffs/ffs_vfsops.c |  19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diffs (40 lines):

diff -r 14f91ec4fc21 -r 548de162f3fa sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Thu Mar 16 10:34:33 2000 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Thu Mar 16 10:37:00 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vfsops.c,v 1.57 2000/02/14 22:00:23 fvdl Exp $     */
+/*     $NetBSD: ffs_vfsops.c,v 1.58 2000/03/16 10:37:00 fvdl Exp $     */
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1994
@@ -284,11 +284,16 @@
        }
        if ((mp->mnt_flag & MNT_UPDATE) == 0) {
                error = ffs_mountfs(devvp, mp, p);
-               if (!error && (mp->mnt_flag & (MNT_SOFTDEP | MNT_ASYNC)) ==
-                   (MNT_SOFTDEP | MNT_ASYNC)) {
-                       printf("%s fs uses soft updates, ignoring async mode\n",
-                           fs->fs_fsmnt);
-                       mp->mnt_flag &= ~MNT_ASYNC;
+               if (!error) {
+                       ump = VFSTOUFS(mp);
+                       fs = ump->um_fs;
+                       if ((mp->mnt_flag & (MNT_SOFTDEP | MNT_ASYNC)) ==
+                           (MNT_SOFTDEP | MNT_ASYNC)) {
+                               printf("%s fs uses soft updates, "
+                                      "ignoring async mode\n",
+                                   fs->fs_fsmnt);
+                               mp->mnt_flag &= ~MNT_ASYNC;
+                       }
                }
        }
        else {
@@ -301,8 +306,6 @@
                vrele(devvp);
                return (error);
        }
-       ump = VFSTOUFS(mp);
-       fs = ump->um_fs;
        (void) copyinstr(path, fs->fs_fsmnt, sizeof(fs->fs_fsmnt) - 1, &size);
        memset(fs->fs_fsmnt + size, 0, sizeof(fs->fs_fsmnt) - size);
        memcpy(mp->mnt_stat.f_mntonname, fs->fs_fsmnt, MNAMELEN);



Home | Main Index | Thread Index | Old Index