diff mbox series

[1/2] libselinux: set an appropriate errno in booleans.c

Message ID 20190131194824.4944-1-plautrba@redhat.com (mailing list archive)
State Accepted
Headers show
Series [1/2] libselinux: set an appropriate errno in booleans.c | expand

Commit Message

Petr Lautrbach Jan. 31, 2019, 7:48 p.m. UTC
Fixes:
$ mkdir booleans
$ sudo mount --bind ./booleans /sys/fs/selinux/booleans
$ sudo getsebool -a
getsebool:  Unable to get boolean names:  Success

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

Comments

Nicolas Iooss Jan. 31, 2019, 10:02 p.m. UTC | #1
On Thu, Jan 31, 2019 at 8:48 PM Petr Lautrbach <plautrba@redhat.com> wrote:
>
> Fixes:
> $ mkdir booleans
> $ sudo mount --bind ./booleans /sys/fs/selinux/booleans
> $ sudo getsebool -a
> getsebool:  Unable to get boolean names:  Success
>
> Signed-off-by: Petr Lautrbach <plautrba@redhat.com>

Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>
> ---
>  libselinux/src/booleans.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libselinux/src/booleans.c b/libselinux/src/booleans.c
> index b3ea3623..a6d46fea 100644
> --- a/libselinux/src/booleans.c
> +++ b/libselinux/src/booleans.c
> @@ -55,6 +55,7 @@ int security_get_boolean_names(char ***names, int *len)
>         snprintf(path, sizeof path, "%s%s", selinux_mnt, SELINUX_BOOL_DIR);
>         *len = scandir(path, &namelist, &filename_select, alphasort);
>         if (*len <= 0) {
> +               errno = ENOENT;
>                 return -1;
>         }
>
> --
> 2.20.1
>
Nicolas Iooss Feb. 5, 2019, 7:18 a.m. UTC | #2
On Thu, Jan 31, 2019 at 11:02 PM Nicolas Iooss <nicolas.iooss@m4x.org> wrote:
>
> On Thu, Jan 31, 2019 at 8:48 PM Petr Lautrbach <plautrba@redhat.com> wrote:
> >
> > Fixes:
> > $ mkdir booleans
> > $ sudo mount --bind ./booleans /sys/fs/selinux/booleans
> > $ sudo getsebool -a
> > getsebool:  Unable to get boolean names:  Success
> >
> > Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
>
> Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>

Merged. Thanks
Nicolas

> > ---
> >  libselinux/src/booleans.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/libselinux/src/booleans.c b/libselinux/src/booleans.c
> > index b3ea3623..a6d46fea 100644
> > --- a/libselinux/src/booleans.c
> > +++ b/libselinux/src/booleans.c
> > @@ -55,6 +55,7 @@ int security_get_boolean_names(char ***names, int *len)
> >         snprintf(path, sizeof path, "%s%s", selinux_mnt, SELINUX_BOOL_DIR);
> >         *len = scandir(path, &namelist, &filename_select, alphasort);
> >         if (*len <= 0) {
> > +               errno = ENOENT;
> >                 return -1;
> >         }
> >
> > --
> > 2.20.1
> >
diff mbox series

Patch

diff --git a/libselinux/src/booleans.c b/libselinux/src/booleans.c
index b3ea3623..a6d46fea 100644
--- a/libselinux/src/booleans.c
+++ b/libselinux/src/booleans.c
@@ -55,6 +55,7 @@  int security_get_boolean_names(char ***names, int *len)
 	snprintf(path, sizeof path, "%s%s", selinux_mnt, SELINUX_BOOL_DIR);
 	*len = scandir(path, &namelist, &filename_select, alphasort);
 	if (*len <= 0) {
+		errno = ENOENT;
 		return -1;
 	}