summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mtree
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2007-12-07 12:22:38 +0000
committerdes <des@FreeBSD.org>2007-12-07 12:22:38 +0000
commit0845b2053ba8c7d8dfc58162fb571300edcc73cc (patch)
tree7802fa4753d96834ad0a588523a5befbe0003457 /usr.sbin/mtree
parentb76f135a28aa5b24e0331359e94e3c55a7800e20 (diff)
downloadFreeBSD-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.c8
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;
OpenPOWER on IntegriCloud