- int nftw_result = nftw(target,
- apply_default_acl_nftw,
- max_levels,
- flags);
+ /* There are two separate functions that could be passed to
+ nftw(). One passes no_exec_mask = true to apply_default_acl(),
+ and the other passes no_exec_mask = false. Since the function we
+ pass to nftw() cannot have parameters, we have to create separate
+ options and make the decision here. */
+ int (*fn)(const char *, const struct stat *, int, struct FTW *) = NULL;
+ fn = no_exec_mask ? apply_default_acl_nftw_x : apply_default_acl_nftw;
+
+ int nftw_result = nftw(target, fn, max_levels, flags);