diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2007-12-07 12:22:38 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2007-12-07 12:22:38 +0000 |
commit | afe54b5818317b574a1b4b0f88c1643efc2c8da2 (patch) | |
tree | 7802fa4753d96834ad0a588523a5befbe0003457 /usr.sbin | |
parent | b358d3906ad888e1f1f76994e381b2002b8b3552 (diff) | |
download | src-afe54b5818317b574a1b4b0f88c1643efc2c8da2.tar.gz src-afe54b5818317b574a1b4b0f88c1643efc2c8da2.zip |
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
Notes
Notes:
svn path=/head/; revision=174403
Diffstat (limited to 'usr.sbin')
-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 7078dbeca678..b7c4fd96e8d5 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; |