Re: [yocto-patches] [pseudo] [PATCH] linkat: Fix AT_EMPTY_PATH handling

Richard Purdie <[email protected]> Mon, 20 Jul 2026 11:57:24 +0100
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <bfa91ba664b418978025bee76de5b95b347c9a4a.camel@linuxfoundation.org>
On Mon, 2026-07-20 at 11:37 +0100, Paul Barker via lists.yoctoproject.org w=
rote:
> On Fri, 2026-07-17 at 14:19 +0100, Richard Purdie via
> lists.yoctoproject.org wrote:
> > Currently we don't cover the case where AT_EMPTY_PATH is set for atlink=
.
>=20
> Typo: s/atlink/linkat/
>=20
> > Update the code to handle this case in a similar way to the /proc/self
> > case which is similar.
> >=20
> > This is used by some systemd tools which OE might run at rootfs time
> > such as hwdb generation.
> >=20
> > Signed-off-by: Richard Purdie <[email protected]>
> > ---
> > =C2=A0ports/unix/guts/linkat.c | 7 ++++++-
> > =C2=A01 file changed, 6 insertions(+), 1 deletion(-)
> >=20
> > diff --git a/ports/unix/guts/linkat.c b/ports/unix/guts/linkat.c
> > index 60fbf63..36ffc0f 100644
> > --- a/ports/unix/guts/linkat.c
> > +++ b/ports/unix/guts/linkat.c
> > @@ -35,13 +35,18 @@
> > =C2=A0	}
> > =C2=A0#endif
> > =C2=A0	oldpath =3D oldname;
> > -	if (pseudo_chroot_len && !strncmp(oldpath, pseudo_chroot, pseudo_chro=
ot_len) &&
> > +	if (oldpath && !*oldpath && pseudo_chroot_len && !strncmp(oldpath, ps=
eudo_chroot, pseudo_chroot_len) &&
>=20
> Should this be if (oldpath && *oldpath && ... ?
>=20
> i.e. if oldpath is non-NULL and has non-zero length.

Well spotted, I've sent a v2, thanks.

Cheers,

Richard