mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-09 16:01:54 -09:00
package/makedevs: fix recursive chmod
The logic implemented in e745c0b to stop makedevs from recursively running
chmod() on dangling symlinks excluded everything that isn't a symlink.
Other file types or directories are skipped/ignored.
Logic has been updated to exit the function if mode shouldn't be changed
or if path is a dangling symlink.
Signed-off-by: Daniel Lang <d.lang@abatec.at>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
committed by
Peter Korsgaard
parent
5d87139f69
commit
d6d8d60ee3
@@ -446,11 +446,12 @@ int bb_recursive(const char *fpath, const struct stat *sb,
|
||||
}
|
||||
|
||||
/* chmod() is optional, also skip if dangling symlink */
|
||||
if (recursive_mode != -1 && tflag == FTW_SL && access(fpath, F_OK)) {
|
||||
if (chmod(fpath, recursive_mode) < 0) {
|
||||
bb_perror_msg("chmod failed for %s", fpath);
|
||||
return -1;
|
||||
}
|
||||
if (recursive_mode == -1 || (tflag == FTW_SL && !access(fpath, F_OK)))
|
||||
return 0;
|
||||
|
||||
if (chmod(fpath, recursive_mode) < 0) {
|
||||
bb_perror_msg("chmod failed for %s", fpath);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user