[PATCH] selinux_restorecon: Do not exit on directory cycles

Johannes Segitz <[email protected]>
Newsgroups org.kernel.vger.selinux
Message-ID <[email protected]>
All other failures are handled gracefully. Directory cycles can e.g.
happen on BTRFS filesystems with subvolumes. Skip them and continue
instead of exiting

Signed-off-by: Johannes Segitz <[email protected]>
---
 libselinux/src/selinux_restorecon.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libselinux/src/selinux_restorecon.c b/libselinux/src/selinux_restorecon.c
index 7ef2d45d..33d315a2 100644
--- a/libselinux/src/selinux_restorecon.c
+++ b/libselinux/src/selinux_restorecon.c
@@ -883,13 +883,12 @@ loop_body:

                switch (ftsent->fts_info) {
                case FTS_DC:
-                       selinux_log(SELINUX_ERROR,
+                       selinux_log(SELINUX_WARNING,
                                    "Directory cycle on %s.\n",
                                    ftsent->fts_path);
                        errno = ELOOP;
-                       state->error = -1;
-                       state->abort = true;
-                       goto finish;
+                       fts_set(fts, ftsent, FTS_SKIP);
+                       continue;
                case FTS_DP:
                        continue;
                case FTS_DNR:
--
2.55.0
signature.asc (application/pgp-signature, 870 B)
-----BEGIN PGP SIGNATURE-----

iQJPBAEBCgA5FiEEJQ9D9ffObx6cWU+VvCfdnSzE/WYFAmpfHSIbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyAAoJELwn3Z0sxP1mvg8P/R4cWcd12HK+Apvi+fXI
Q6b1GFWJD2wuhyXCDE2iWhlnvZJ1hTNPHPkahNASSqCzOny4oLrn0mywY5bwOH/j
PXh1hVXFHG6/6eir8TmCYNyjP8dB0HLwhVnRtnlpQnN2EpCF5WoiMvbmaVaCIRpk
Wm88lokSh5y3qhYKocp2KBXvywwPBg+cajm4ECpDm82QHYr7iLURR5xfVHsaBn4H
xciXyCuX3sRRbPWZhDzUOKTYfKjjb2T1px1SF/zd5XfJcaqPRa+ijNZI2JHIJCK0
oIJ6jnQjDnkLVuZCDz15fZFkGbRkAXiE5YKwSm1wxt06v52lgYU04eLh1UNhqAsj
QRqm7VQSWEpQrZuOSpkVl9XR8vju2gBgxT0q8mpHD9obB+yM+zj3Rk56aEei27/R
C0w1ZBYTdzxPrVp6daDt6tLlGUgkwrzAvPNuuZN3BgoeN5ZGoj/fTIPWnKvnYHS4
pkCx7BF+n5J/GaK4rj9NM3If0h1wzo/X2v9zDY4ZNcxtKG27yEugSONpSBRnYLu0
5EX6ODgmcr+cg1So6/vFTs26MToVQZgQgu6BvlXTqgz3gtIz/t7ZB4oKUm6s5Zw5
tIjdvpaaVuvE7AKqnp46IutEqNC3FNt+PrlcY7awZA3VbDSXBWyFY2HWPYe9uX34
s5trLG4ZpJ5htvmWXH6YK1nQ
=ULU2
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.