diff mbox series

libselinux/selinux_restorecon: Skip customized files also without -v

Message ID 20190206194111.24729-1-plautrba@redhat.com (mailing list archive)
State Accepted
Headers show
Series libselinux/selinux_restorecon: Skip customized files also without -v | expand

Commit Message

Petr Lautrbach Feb. 6, 2019, 7:41 p.m. UTC
In the original code, customizable file contexts were not changed only if -v was
used. It lead to different behavior when selinux_restorecon was run with -v and
without it.

Based on an initial patch by Jan Zarsky <jzarsky@redhat.com>

Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
---
 libselinux/src/selinux_restorecon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nicolas Iooss Feb. 7, 2019, 9:23 p.m. UTC | #1
On Wed, Feb 6, 2019 at 8:41 PM Petr Lautrbach <plautrba@redhat.com> wrote:
>
> In the original code, customizable file contexts were not changed only if -v was
> used. It lead to different behavior when selinux_restorecon was run with -v and
> without it.
>
> Based on an initial patch by Jan Zarsky <jzarsky@redhat.com>
>
> Signed-off-by: Petr Lautrbach <plautrba@redhat.com>

Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>
> ---
>  libselinux/src/selinux_restorecon.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libselinux/src/selinux_restorecon.c b/libselinux/src/selinux_restorecon.c
> index 42a48f5a..0f0fd6ca 100644
> --- a/libselinux/src/selinux_restorecon.c
> +++ b/libselinux/src/selinux_restorecon.c
> @@ -672,8 +672,8 @@ static int restorecon_sb(const char *pathname, const struct stat *sb,
>                                 selinux_log(SELINUX_INFO,
>                                  "%s not reset as customized by admin to %s\n",
>                                                             pathname, curcon);
> -                               goto out;
>                         }
> +                       goto out;
>                 }
>
>                 if (!flags->set_specctx && curcon) {
> --
> 2.20.1
>
Nicolas Iooss Feb. 10, 2019, 4:50 p.m. UTC | #2
On Thu, Feb 7, 2019 at 10:23 PM Nicolas Iooss <nicolas.iooss@m4x.org> wrote:
>
> On Wed, Feb 6, 2019 at 8:41 PM Petr Lautrbach <plautrba@redhat.com> wrote:
> >
> > In the original code, customizable file contexts were not changed only if -v was
> > used. It lead to different behavior when selinux_restorecon was run with -v and
> > without it.
> >
> > Based on an initial patch by Jan Zarsky <jzarsky@redhat.com>
> >
> > Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
>
> Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>

Merged.

Nicolas

> > ---
> >  libselinux/src/selinux_restorecon.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libselinux/src/selinux_restorecon.c b/libselinux/src/selinux_restorecon.c
> > index 42a48f5a..0f0fd6ca 100644
> > --- a/libselinux/src/selinux_restorecon.c
> > +++ b/libselinux/src/selinux_restorecon.c
> > @@ -672,8 +672,8 @@ static int restorecon_sb(const char *pathname, const struct stat *sb,
> >                                 selinux_log(SELINUX_INFO,
> >                                  "%s not reset as customized by admin to %s\n",
> >                                                             pathname, curcon);
> > -                               goto out;
> >                         }
> > +                       goto out;
> >                 }
> >
> >                 if (!flags->set_specctx && curcon) {
> > --
> > 2.20.1
> >
diff mbox series

Patch

diff --git a/libselinux/src/selinux_restorecon.c b/libselinux/src/selinux_restorecon.c
index 42a48f5a..0f0fd6ca 100644
--- a/libselinux/src/selinux_restorecon.c
+++ b/libselinux/src/selinux_restorecon.c
@@ -672,8 +672,8 @@  static int restorecon_sb(const char *pathname, const struct stat *sb,
 				selinux_log(SELINUX_INFO,
 				 "%s not reset as customized by admin to %s\n",
 							    pathname, curcon);
-				goto out;
 			}
+			goto out;
 		}
 
 		if (!flags->set_specctx && curcon) {