From 5104ed9c4aad13b34eaeade458da0619cc5b5a98 Mon Sep 17 00:00:00 2001 From: "Rodney W. Grimes" Date: Mon, 19 Sep 1994 01:32:57 +0000 Subject: [PATCH] My optimization to eliminate /set records was a little too aggressive, it optimized away the first one :-(. --- usr.sbin/mtree/create.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/usr.sbin/mtree/create.c b/usr.sbin/mtree/create.c index 8901f44f0384..852998638c31 100644 --- a/usr.sbin/mtree/create.c +++ b/usr.sbin/mtree/create.c @@ -215,6 +215,7 @@ statd(t, parent, puid, pgid, pmode) uid_t saveuid = *puid; mode_t savemode = *pmode; u_short maxgid, maxuid, maxmode, g[MAXGID], u[MAXUID], m[MAXMODE]; + static int first = 1; if ((p = fts_children(t, 0)) == NULL) { if (errno) @@ -248,11 +249,13 @@ statd(t, parent, puid, pgid, pmode) } /* * If the /set record is the same as the last one we do not need to output - * a new one. So first we check to see if anything changed. + * a new one. So first we check to see if anything changed. Note that we + * always output a /set record for the first directory. */ if ((((keys & F_UNAME) | (keys & F_UID)) && (*puid != saveuid)) || (((keys & F_GNAME) | (keys & F_GID)) && (*pgid != savegid)) || - ((keys & F_MODE) && (*pmode != savemode))) { + ((keys & F_MODE) && (*pmode != savemode)) || (first)) { + first = 0; if (dflag) (void)printf("/set type=dir"); else