* lib/fts.c (fts_read): Revert the change of 2006-11-22, since it
narrowed the st_size value. Presuming the "can't happen" condition
is true, that narrowing could conceivably convert an invalid st_size
value into a valid one. Instead, use a change based on Matthew
Woehlke's original patch.
2007-01-08 Jim Meyering <jim@meyering.net>
+ Use a more robust test for a "can't happen" condition.
+ * lib/fts.c (fts_read): Revert the change of 2006-11-22, since it
+ narrowed the st_size value. Presuming the "can't happen" condition
+ is true, that narrowing could conceivably convert an invalid st_size
+ value into a valid one. Instead, use a change based on Matthew
+ Woehlke's original patch.
+
Slight readability improvement: use an assert-like macro
in place of literal "abort ()" uses.
* lib/fts.c (fts_assert): Define.
check_for_dir:
if (p->fts_info == FTS_NSOK)
{
- enum Fts_stat need_stat = p->fts_statp->st_size;
- switch (need_stat)
- {
- case FTS_STAT_REQUIRED:
- p->fts_info = fts_stat(sp, p, false);
- break;
- case FTS_NO_STAT_REQUIRED:
- break;
- default:
- fts_assert (0);
- }
+ if (p->fts_statp->st_size == FTS_STAT_REQUIRED)
+ p->fts_info = fts_stat(sp, p, false);
+ else
+ fts_assert (p->fts_statp->st_size == FTS_NO_STAT_REQUIRED);
}
sp->fts_cur = p;