Ignore files that vanish during relabeling if ignore_noent is set
PATCH 1/1 Ignore files that vanish during relabeling if ignore_noent is set
This happens e.g. when temporary files vanish during labeling the file system. I don't like it that this is now in the err: handler, but otherwise it would need to be repeated above a couple of times
--- libselinux/src/selinux_restorecon.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
libselinux/src/selinux_restorecon.c +9 -4
@@ -768,10 +768,15 @@ out1:freecon (newcon);return rc; err: -selinux_log (SELINUX_ERROR , -"Could not set context for %s: %m\n" , - pathname); - rc =-1 ; +if (flags->ignore_noent && errno ==ENOENT ) { +// Sometimes files gets deleted while the relabeling happens + goto out; + }else { +selinux_log (SELINUX_ERROR , +"Could not set context for %s: %m\n" , + pathname); + rc =-1 ; + } goto out1; }
--
2.52.0
Hi,
does this still happen with https://github.com/SELinuxProject/selinux/commit/54c79a74f5b9154762abaadf8194665598b24115 applied?
Vit
Quoted 35 lines · Johannes Segitz
This happens e.g. when temporary files vanish during labeling the file system. I don't like it that this is now in the err: handler, but otherwise it would need to be repeated above a couple of times
Signed-off-by Johannes Segitz <[email protected]>--- libselinux/src/selinux_restorecon.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)libselinux/src/selinux_restorecon.c +9
-5@@ -768,10 +768,15 @@ out1:freecon (newcon);return rc; err: -selinux_log (SELINUX_ERROR , -"Could not set context for %s: %m\n" , - pathname); - rc =-1 ; +if (flags->ignore_noent && errno ==ENOENT ) { +// Sometimes files gets deleted while the relabeling happens + goto out; + }else { +selinux_log (SELINUX_ERROR , +"Could not set context for %s: %m\n" , + pathname); + rc =-1 ; + } goto out1; } --2.52.0
Sorry for the late reply, was on long term sick leave
Quoted 2 lines · Vit Mojzis
does this still happen with https://github.com/SELinuxProject/selinux/commit/54c79a74f5b9154762abaadf8194665598b24115
applied?
no, doesn't happen with that, thanks
Johannes
Signature · 4 lines
GPG Key EE16 6BCE AD56 E034 BFB3 3ADD 7BF7 29D5 E7C8 1FA0 Subkey fingerprint: 250F 43F5 F7CE 6F1E 9C59 4F95 BC27 DD9D 2CC4 FD66 SUSE Software Solutions Germany GmbH, Frankenstr. 146, 90461 Nürnberg, Germany Geschäftsführer: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)