[PATCH v2] elf: should check result of openat with -1 not 1

Yury Khrustalev yury.khrustalev@arm.com
Thu Mar 5 16:39:35 GMT 2026


Hello Weixie,

Apologies for the delay. The patch looks good and I'm happy to merge it
for you.

On Fri, Feb 27, 2026 at 07:40:58PM +0800, Weixie Cui wrote:
> From: Weixie Cui <cuiweixie@gmail.com>
> 
> Signed-off-by: Weixie Cui <cuiweixie@gmail.com>
> ---
>  elf/pldd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/elf/pldd.c b/elf/pldd.c
> index b9e20aa6fa..62e660c3f8 100644
> --- a/elf/pldd.c
> +++ b/elf/pldd.c
> @@ -137,7 +137,7 @@ main (int argc, char *argv[])
>    } *thread_list = NULL;
>  
>    int taskfd = openat (dfd, "task", O_RDONLY | O_DIRECTORY | O_CLOEXEC);
> -  if (taskfd == 1)
> +  if (taskfd == -1)
>      error (EXIT_FAILURE, errno, gettext ("cannot open %s/task"), buf);
>    DIR *dir = fdopendir (taskfd);
>    if (dir == NULL)
> -- 
> 2.39.5 (Apple Git-154)
>

LGTM.

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>

Kind regards,
Yury



More information about the Libc-alpha mailing list