package/makedevs: allow recursive on directory with symlinks
PATCH 1/1 package/makedevs: allow recursive on directory with symlinks
When using BR2_ROOTFS_DEVICE_TABLE to change ownership of /etc, like so:
/etc r -1 root wheel - - - - -
makdevs fails due to it trying to chown() a symlink:
makedevs: chown failed for /src/myLinux/output/build/buildroot-fs/ext2/target/etc/mtab: No such file or directory
makedevs: line 25: recursive failed for /src/myLinux/output/build/buildroot-fs/ext2/target/etc: No such file or directory make[2]: *** [fs/ext2/ext2.mk:63: /src/myLinux/output/images/rootfs.ext2] Error 1
make[1]: *** [Makefile:84: _all] Error 2
make[1]: Leaving directory '/src/myLinux/buildroot'
This patch checks the type of fpath before continuing, since we call nftw() with FTW_PHYS we can rely on FTW_SL to check and skip.
Also included, some minor coding style cleanup and marking of unused callback arguments.
--- package/makedevs/makedevs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
package/makedevs/makedevs.c +4 -2
@@ -437,8 +437,10 @@ void bb_show_usage(void)exit (1 ); } -int bb_recursive (const char *fpath,const struct stat *sb, -int tflag,struct FTW *ftwbuf){ +int bb_recursive (const char *fpath,const struct stat *_,int type,struct FTW *__) +{ +if (type ==FTW_SL ) +return 0 ;/* Skip symlinks, cannot chown/chmod them */ if (chown (fpath, recursive_uid, recursive_gid) ==-1 ) {bb_perror_msg ("chown failed for %s" , fpath);
Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot