From: Michael Orlitzky Date: Fri, 2 Mar 2018 20:19:13 +0000 (-0500) Subject: Replace nftw() with manual recursion in apply_default_acl(). X-Git-Tag: v0.3.0~7 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;ds=sidebyside;h=8373437e3e99e776f99ae592f2a0f2560317cc0a;hp=8373437e3e99e776f99ae592f2a0f2560317cc0a;p=apply-default-acl.git Replace nftw() with manual recursion in apply_default_acl(). The nftw() tree walk worked well for a while; in particular, before we handled symlinks safely, it was empirically faster than a hand-written recursive descent. But recently, the very slow safe_open() function was being called on the path that was passed to apply_default_acl(), and nftw() fed that function a whole bunch of paths. The apply_default_acl() function now takes a third "recusive" parameter, and implements the recursion on its own. This lets us pass down the old child file descriptor as the new parent file descriptor, and avoid calling safe_open() more than once when we're operating recursively. The result is a big speed improvement with --recursive, tested for example on the Linux kernel source tree. The hand-written recursion also allows us to fix a lingering exit code bug. Now --recursive acts as if all of the targets were passed (in the right order) on the command-line. The new parameter affects the public API, so in the next release the library will get a new version. The upside to this is that now it's easy for other programs to operate recursively, simply by passing "true" as the third parameter to apply_default_acl(). ---