diff options
author | des <des@FreeBSD.org> | 2007-12-07 12:22:38 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2007-12-07 12:22:38 +0000 |
commit | 0845b2053ba8c7d8dfc58162fb571300edcc73cc (patch) | |
tree | 7802fa4753d96834ad0a588523a5befbe0003457 /usr.sbin/mtree | |
parent | b76f135a28aa5b24e0331359e94e3c55a7800e20 (diff) | |
download | FreeBSD-src-0845b2053ba8c7d8dfc58162fb571300edcc73cc.zip FreeBSD-src-0845b2053ba8c7d8dfc58162fb571300edcc73cc.tar.gz |
When applying a spec, traverse the existing directory tree in lexical
order. This allows direct comparison of the output of two different
runs, regardless of the order in which readdir(2) returns directory
entries.
MFC after: 3 weeks
Diffstat (limited to 'usr.sbin/mtree')
-rw-r--r-- | usr.sbin/mtree/verify.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/mtree/verify.c b/usr.sbin/mtree/verify.c index 7078dbe..b7c4fd9 100644 --- a/usr.sbin/mtree/verify.c +++ b/usr.sbin/mtree/verify.c @@ -65,6 +65,12 @@ mtree_verifyspec(FILE *fi) } static int +nsort(const FTSENT * const *a, const FTSENT * const *b) +{ + return (strcmp((*a)->fts_name, (*b)->fts_name)); +} + +static int vwalk(void) { FTS *t; @@ -76,7 +82,7 @@ vwalk(void) argv[0] = dot; argv[1] = NULL; - if ((t = fts_open(argv, ftsoptions, NULL)) == NULL) + if ((t = fts_open(argv, ftsoptions, nsort)) == NULL) err(1, "line %d: fts_open", lineno); level = root; specdepth = rval = 0; |