"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
Re: -portable: add a wrapper for open() on FreeBSD
To:
gameoftrees@openbsd.org
Date:
Sun, 26 Sep 2021 15:48:19 +0200

Download raw body.

Thread
Stefan Sperling:

> +int
> +got_err_open_nofollow_on_symlink(void)
> +{
> +	/*
> +	 * Check whether open(2) with O_NOFOLLOW failed on a symlink.
> +	 * Posix mandates ELOOP and OpenBSD follows it. Others return
> +	 * different error codes. We carry this workaround to help the
> +	 * portable version a little.
> +	 */
> +	return (errno == ELOOP || errno == EMLINK || errno == EFTYPE);
> +}

This is in itself a portability problem.  I don't think Linux even
has EFTYPE.

We'll need to do something like this in -portable:

        return (errno == ELOOP
#if   defined(__FreeBSD__)
            || errno == EMLINK
#elif defined(__NetBSD__)
            || errno == EFTYPE
#endif
            );

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de