All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 1/4] package/makedevs: fix recursive chmod
@ 2022-09-12  6:10 Lang Daniel via buildroot
  2022-09-17 21:31 ` Peter Korsgaard
  2022-09-29  6:08 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: Lang Daniel via buildroot @ 2022-09-12  6:10 UTC (permalink / raw)
  To: buildroot; +Cc: Matt Weber

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>
---
Changes v1 -> v2:
  - Integrated into the polkit patch series, since the changes are needed
    for the polkit tests.
---
 package/makedevs/makedevs.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/package/makedevs/makedevs.c b/package/makedevs/makedevs.c
index 2796cd5e78..a5c9c7d64d 100644
--- a/package/makedevs/makedevs.c
+++ b/package/makedevs/makedevs.c
@@ -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;
-- 
2.25.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH v2 1/4] package/makedevs: fix recursive chmod
  2022-09-12  6:10 [Buildroot] [PATCH v2 1/4] package/makedevs: fix recursive chmod Lang Daniel via buildroot
@ 2022-09-17 21:31 ` Peter Korsgaard
  2022-09-29  6:08 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2022-09-17 21:31 UTC (permalink / raw)
  To: Lang Daniel via buildroot; +Cc: Lang Daniel, Matt Weber

>>>>> "Lang" == Lang Daniel via buildroot <buildroot@buildroot.org> writes:

 > 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>
 > ---
 > Changes v1 -> v2:
 >   - Integrated into the polkit patch series, since the changes are needed
 >     for the polkit tests.

Committed, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH v2 1/4] package/makedevs: fix recursive chmod
  2022-09-12  6:10 [Buildroot] [PATCH v2 1/4] package/makedevs: fix recursive chmod Lang Daniel via buildroot
  2022-09-17 21:31 ` Peter Korsgaard
@ 2022-09-29  6:08 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2022-09-29  6:08 UTC (permalink / raw)
  To: Lang Daniel via buildroot; +Cc: Lang Daniel, Matt Weber

>>>>> "Lang" == Lang Daniel via buildroot <buildroot@buildroot.org> writes:

 > 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>
 > ---
 > Changes v1 -> v2:
 >   - Integrated into the polkit patch series, since the changes are needed
 >     for the polkit tests.

Committed to 2022.02.x, 2022.05.x and 2022.08.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-29  6:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-12  6:10 [Buildroot] [PATCH v2 1/4] package/makedevs: fix recursive chmod Lang Daniel via buildroot
2022-09-17 21:31 ` Peter Korsgaard
2022-09-29  6:08 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.