[hackers] [sbase] [PATCH 2/2] [chmod] Use DIRFIRST

From: David Phillips <david_AT_sighup.nz>
Date: Sun, 1 Oct 2017 16:36:05 +1300

Previosuly, 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.
---
 chmod.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/chmod.c b/chmod.c
index f671f32..c12d2f4 100644
--- a/chmod.c
+++ b/chmod.c
_AT_@ -32,7 +32,7 @@ int
 main(int argc, char *argv[])
 {
 	struct recursor r = { .fn = chmodr, .hist = NULL, .depth = 0, .maxdepth = 1,
-	                      .follow = 'P', .flags = 0 };
+	                      .follow = 'P', .flags = DIRFIRST };
 	size_t i;
 
 	argv0 = *argv, argv0 ? (argc--, argv++) : (void *)0;
-- 
2.14.1
Received on Sun Oct 01 2017 - 05:36:05 CEST

This archive was generated by hypermail 2.3.0 : Sun Oct 01 2017 - 05:48:20 CEST