From bce3675a338eb8fa4f1c54d14632925b7731d795 Mon Sep 17 00:00:00 2001 From: kan Date: Wed, 28 Jul 2004 05:59:22 +0000 Subject: [PATCH] Avoid casts as lvalues. --- sbin/dump/traverse.c | 10 ++++++++-- sbin/fsirand/fsirand.c | 5 +++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/sbin/dump/traverse.c b/sbin/dump/traverse.c index 332bc273e52c..08e5e23e04c2 100644 --- a/sbin/dump/traverse.c +++ b/sbin/dump/traverse.c @@ -63,6 +63,12 @@ union dinode { #define DIP(dp, field) \ ((sblock->fs_magic == FS_UFS1_MAGIC) ? \ (dp)->dp1.field : (dp)->dp2.field) +#define DIP_SET(dp, field, val) do {\ + if (sblock->fs_magic == FS_UFS1_MAGIC) \ + (dp)->dp1.field = (val); \ + else \ + (dp)->dp2.field = (val); \ + } while (0) #define HASDUMPEDFILE 0x1 #define HASSUBDIRS 0x2 @@ -446,8 +452,8 @@ dumpino(union dinode *dp, ino_t ino) * as a zero length file. */ if ((DIP(dp, di_flags) & SF_SNAPSHOT) != 0) { - DIP(dp, di_size) = 0; - DIP(dp, di_flags) &= ~SF_SNAPSHOT; + DIP_SET(dp, di_size, 0); + DIP_SET(dp, di_flags, DIP(dp, di_flags) & ~SF_SNAPSHOT); } if (sblock->fs_magic == FS_UFS1_MAGIC) { spcl.c_mode = dp->dp1.di_mode; diff --git a/sbin/fsirand/fsirand.c b/sbin/fsirand/fsirand.c index 7b6274fb64e7..defdf5250d33 100644 --- a/sbin/fsirand/fsirand.c +++ b/sbin/fsirand/fsirand.c @@ -274,9 +274,10 @@ fsirand(char *device) inumber, sblock->fs_magic == FS_UFS1_MAGIC ? (quad_t)dp1->di_gen : dp2->di_gen); + else if (sblock->fs_magic == FS_UFS1_MAGIC) + dp1->di_gen = random(); else - (sblock->fs_magic == FS_UFS1_MAGIC ? - dp1->di_gen : dp2->di_gen) = random(); + dp2->di_gen = random(); } }