smack-team/smack — pull request #71 by rafal-krypa (2013-12-02 16:20:11+00:00)
Title: Use fts functions for scanning directories

The BSD functions `fts_open()` and `fts_read()` are a nice alternative to ftw/ntfw and manual directory reading. This commit replaces existing `readdir()` and `nftw()` usage to get:
- applying CIPSO rules in one shot, just like regular rules
- sort input files alphabetically to load them in a defined order (`readdir()` order is file system dependant)
- loading rules works on file systems not setting d_type on `readdir()` (fix 233dc30 regression)
- better performance compared to `nftw()` due to fewer calls to `stat()` internally
- shorter code due to unified handling of load from file and from directory