mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-10-01 06:21:56 -09:00
package/makedevs: fix recursive chmod
The logic implemented ine745c0bto 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> (cherry picked from commitd6d8d60ee3) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
committed by
Peter Korsgaard
parent
105b98d266
commit
dfa664d163
@@ -446,11 +446,12 @@ int bb_recursive(const char *fpath, const struct stat *sb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* chmod() is optional, also skip if dangling symlink */
|
/* chmod() is optional, also skip if dangling symlink */
|
||||||
if (recursive_mode != -1 && tflag == FTW_SL && access(fpath, F_OK)) {
|
if (recursive_mode == -1 || (tflag == FTW_SL && !access(fpath, F_OK)))
|
||||||
if (chmod(fpath, recursive_mode) < 0) {
|
return 0;
|
||||||
bb_perror_msg("chmod failed for %s", fpath);
|
|
||||||
return -1;
|
if (chmod(fpath, recursive_mode) < 0) {
|
||||||
}
|
bb_perror_msg("chmod failed for %s", fpath);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user