chmod: Use DIRFIRST

Previously, running `chmod 777` on a directory that had no read or
execute access (e.g. 111 or 000) would cause chmod to throw its
toys since it was trying to opendir before having added read permission
to the directory.
This commit is contained in:
David Phillips 2017-10-01 16:36:05 +13:00 committed by Michael Forney
parent 69b9c2444b
commit e1c56a6321
1 changed files with 1 additions and 1 deletions

View File

@ -32,7 +32,7 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
struct recursor r = { .fn = chmodr, .hist = NULL, .depth = 0, .maxdepth = 1, struct recursor r = { .fn = chmodr, .hist = NULL, .depth = 0, .maxdepth = 1,
.follow = 'P', .flags = 0 }; .follow = 'P', .flags = DIRFIRST };
size_t i; size_t i;
argv0 = *argv, argv0 ? (argc--, argv++) : (void *)0; argv0 = *argv, argv0 ? (argc--, argv++) : (void *)0;