Re: [PATCH] libselinux: Add missing errno setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, Apr 6, 2020 at 4:16 PM Richard Filo <rfilo@xxxxxxxxxx> wrote:
>
> fixes: https://src.fedoraproject.org/tests/selinux/issue/51
>
> Errno is not set to ENOENT when lookup_all() doesn't find any match.

Please put the issue link after the explanation (the link is just
additional information).

Also, you need to add a "Signed-off-by:" line to the end of the commit
message (for legal reasons), see:
https://github.com/SELinuxProject/selinux/blob/master/CONTRIBUTING.md#contributing-code
https://opensource.com/article/18/3/cla-vs-dco-whats-difference

> ---
>  libselinux/src/label_file.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libselinux/src/label_file.c b/libselinux/src/label_file.c
> index 300625c2..113bb9b7 100644
> --- a/libselinux/src/label_file.c
> +++ b/libselinux/src/label_file.c
> @@ -948,6 +948,8 @@ static const struct spec **lookup_all(struct selabel_handle *rec,
>                         goto finish;
>                 }
>         }
> +       if (result && !result[0])

'result' can never be NULL here, so you can drop the first part of the check.

> +               errno = ENOENT;
>
>  finish:
>         free(clean_key);
> --
> 2.25.2
>

--
Ondrej Mosnacek <omosnace at redhat dot com>
Software Engineer, Security Technologies
Red Hat, Inc.




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux