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
This commit is contained in:
Dag-Erling Smørgrav 2007-12-07 12:22:38 +00:00
parent b358d3906a
commit afe54b5818
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=174403

View File

@ -64,6 +64,12 @@ mtree_verifyspec(FILE *fi)
return (rval);
}
static int
nsort(const FTSENT * const *a, const FTSENT * const *b)
{
return (strcmp((*a)->fts_name, (*b)->fts_name));
}
static int
vwalk(void)
{
@ -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;