Re: [PATCH 1/2] libselinux: do not call close(fd) when fd < 0

Stephen Smalley <[email protected]> Tue, 21 Jul 2026 08:54:25 -0400
Newsgroups org.kernel.vger.selinux
Message-ID <CAEjxPJ5ab_=+wUD_EK3U3WCn9s4B48PwrXq1=DtJ+FqBn4ia4A@mail.gmail.com>
On Fri, Jul 17, 2026 at 10:33 AM Stephen Smalley
<[email protected]> wrote:
>
> The error path was incorrectly calling close(fd) when fd < 0.
>
> Signed-off-by: Stephen Smalley <[email protected]>

This series has been merged.

> ---
>  libselinux/utils/sefcontext_compile.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/libselinux/utils/sefcontext_compile.c b/libselinux/utils/sefcontext_compile.c
> index ab73180d..f8115026 100644
> --- a/libselinux/utils/sefcontext_compile.c
> +++ b/libselinux/utils/sefcontext_compile.c
> @@ -707,7 +707,6 @@ int main(int argc, char *argv[])
>         if (fd < 0) {
>                 fprintf(stderr, "%s: mkstemp %s failed: %s\n", argv[0], tmp,
>                         strerror(errno));
> -               close(fd);
>                 goto err;
>         }
>
> --
> 2.55.0
>