diff options
author | rgrimes <rgrimes@FreeBSD.org> | 1994-09-19 01:32:57 +0000 |
---|---|---|
committer | rgrimes <rgrimes@FreeBSD.org> | 1994-09-19 01:32:57 +0000 |
commit | 7be4a7b142450a1189cd526bd04efcac5c255e30 (patch) | |
tree | dc906b546642d04da479c5fb9b9685f947756f20 /usr.sbin | |
parent | c203d7f339fbcc7e2829c5363e4a963013239fb2 (diff) | |
download | FreeBSD-src-7be4a7b142450a1189cd526bd04efcac5c255e30.zip FreeBSD-src-7be4a7b142450a1189cd526bd04efcac5c255e30.tar.gz |
My optimization to eliminate /set records was a little too aggressive, it
optimized away the first one :-(.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/mtree/create.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/mtree/create.c b/usr.sbin/mtree/create.c index 8901f44..8529986 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 |