* [PATCH] libselinux: Add missing errno setup
@ 2020-04-06 14:16 Richard Filo
2020-04-06 16:55 ` Ondrej Mosnacek
0 siblings, 1 reply; 7+ messages in thread
From: Richard Filo @ 2020-04-06 14:16 UTC (permalink / raw)
To: selinux
fixes: https://src.fedoraproject.org/tests/selinux/issue/51
Errno is not set to ENOENT when lookup_all() doesn't find any match.
---
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])
+ errno = ENOENT;
finish:
free(clean_key);
--
2.25.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] libselinux: Add missing errno setup
2020-04-06 14:16 [PATCH] libselinux: Add missing errno setup Richard Filo
@ 2020-04-06 16:55 ` Ondrej Mosnacek
2020-05-04 8:45 ` [PATCH v2] " Richard Filo
0 siblings, 1 reply; 7+ messages in thread
From: Ondrej Mosnacek @ 2020-04-06 16:55 UTC (permalink / raw)
To: Richard Filo; +Cc: SElinux list
Hi,
On Mon, Apr 6, 2020 at 4:16 PM Richard Filo <rfilo@redhat.com> 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] libselinux: Add missing errno setup
2020-04-06 16:55 ` Ondrej Mosnacek
@ 2020-05-04 8:45 ` Richard Filo
2020-05-04 9:01 ` Ondrej Mosnacek
0 siblings, 1 reply; 7+ messages in thread
From: Richard Filo @ 2020-05-04 8:45 UTC (permalink / raw)
To: selinux; +Cc: Richard Filo
Errno is not set to ENOENT when lookup_all() doesn't find any match.
fixes: https://src.fedoraproject.org/tests/selinux/issue/51
Signed-off-by: Richard Filo <rfilo@redhat.com>
---
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])
+ errno = ENOENT;
finish:
free(clean_key);
--
2.25.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] libselinux: Add missing errno setup
2020-05-04 8:45 ` [PATCH v2] " Richard Filo
@ 2020-05-04 9:01 ` Ondrej Mosnacek
2020-05-04 10:38 ` [PATCH v3] " Richard Filo
0 siblings, 1 reply; 7+ messages in thread
From: Ondrej Mosnacek @ 2020-05-04 9:01 UTC (permalink / raw)
To: Richard Filo; +Cc: SElinux list
On Mon, May 4, 2020 at 10:45 AM Richard Filo <rfilo@redhat.com> wrote:
> Errno is not set to ENOENT when lookup_all() doesn't find any match.
>
> fixes: https://src.fedoraproject.org/tests/selinux/issue/51
>
> Signed-off-by: Richard Filo <rfilo@redhat.com>
> ---
> 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])
> + errno = ENOENT;
Sorry for not spotting this earlier, but there is no need to check if
result != NULL, because it will always be non-NULL at this point. So
you should only do the second part of the check (!result[0]). The
check under the "finish" label needs to check both, because you can
get there also via the allocation-failed path, where "result" would be
NULL.
>
> finish:
> free(clean_key);
> --
> 2.25.2
>
--
Ondrej Mosnacek <omosnace at redhat dot com>
Software Engineer, Security Technologies
Red Hat, Inc.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3] libselinux: Add missing errno setup
2020-05-04 9:01 ` Ondrej Mosnacek
@ 2020-05-04 10:38 ` Richard Filo
2020-05-04 11:08 ` Ondrej Mosnacek
0 siblings, 1 reply; 7+ messages in thread
From: Richard Filo @ 2020-05-04 10:38 UTC (permalink / raw)
To: selinux; +Cc: Richard Filo
Errno is not set to ENOENT when lookup_all() doesn't find any match.
fixes: https://src.fedoraproject.org/tests/selinux/issue/51
Signed-off-by: Richard Filo <rfilo@redhat.com>
---
-removed check: result != NULL
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..74d2027e 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[0])
+ errno = ENOENT;
finish:
free(clean_key);
--
2.25.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v3] libselinux: Add missing errno setup
2020-05-04 10:38 ` [PATCH v3] " Richard Filo
@ 2020-05-04 11:08 ` Ondrej Mosnacek
2020-05-06 14:10 ` Petr Lautrbach
0 siblings, 1 reply; 7+ messages in thread
From: Ondrej Mosnacek @ 2020-05-04 11:08 UTC (permalink / raw)
To: Richard Filo; +Cc: SElinux list
On Mon, May 4, 2020 at 12:39 PM Richard Filo <rfilo@redhat.com> wrote:
> Errno is not set to ENOENT when lookup_all() doesn't find any match.
>
> fixes: https://src.fedoraproject.org/tests/selinux/issue/51
>
> Signed-off-by: Richard Filo <rfilo@redhat.com>
> ---
> -removed check: result != NULL
>
> 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..74d2027e 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[0])
> + errno = ENOENT;
>
> finish:
> free(clean_key);
> --
> 2.25.2
Acked-by: Ondrej Mosnacek <omosnace@redhat.com>
Thanks!
--
Ondrej Mosnacek <omosnace at redhat dot com>
Software Engineer, Security Technologies
Red Hat, Inc.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3] libselinux: Add missing errno setup
2020-05-04 11:08 ` Ondrej Mosnacek
@ 2020-05-06 14:10 ` Petr Lautrbach
0 siblings, 0 replies; 7+ messages in thread
From: Petr Lautrbach @ 2020-05-06 14:10 UTC (permalink / raw)
To: SElinux list; +Cc: Richard Filo, Ondrej Mosnacek
[-- Attachment #1: Type: text/plain, Size: 1344 bytes --]
On Mon, May 04, 2020 at 01:08:33PM +0200, Ondrej Mosnacek wrote:
> On Mon, May 4, 2020 at 12:39 PM Richard Filo <rfilo@redhat.com> wrote:
> > Errno is not set to ENOENT when lookup_all() doesn't find any match.
> >
> > fixes: https://src.fedoraproject.org/tests/selinux/issue/51
> >
> > Signed-off-by: Richard Filo <rfilo@redhat.com>
> > ---
> > -removed check: result != NULL
> >
> > 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..74d2027e 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[0])
> > + errno = ENOENT;
> >
> > finish:
> > free(clean_key);
> > --
> > 2.25.2
>
> Acked-by: Ondrej Mosnacek <omosnace@redhat.com>
>
> Thanks!
>
^&^ git am v3-libselinux-Add-missing-errno-setup.patch
Applying: libselinux: Add missing errno setup
.git/rebase-apply/patch:15: trailing whitespace.
if (!result[0])
warning: 1 line adds whitespace errors.
I have fixed the trailing whitespace and applied it.
Thanks.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-05-06 14:10 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-06 14:16 [PATCH] libselinux: Add missing errno setup Richard Filo
2020-04-06 16:55 ` Ondrej Mosnacek
2020-05-04 8:45 ` [PATCH v2] " Richard Filo
2020-05-04 9:01 ` Ondrej Mosnacek
2020-05-04 10:38 ` [PATCH v3] " Richard Filo
2020-05-04 11:08 ` Ondrej Mosnacek
2020-05-06 14:10 ` Petr Lautrbach
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.