Re: [PATCH v2 1/2] tools/nolibc: Add dirfd()
From: Daniel Palmer
Date: Mon Oct 12 2026 - 03:30:12 EST
Hi David,
On Thu, 8 Oct 2026 at 16:59, David Laight <david.laight.linux@xxxxxxxxx> wrote:
> > +/* Internal dirfd() that does not set errno */
> > +static __attribute__((unused))
> > +int __nolibc_dirfd(DIR *dirp)
> > +{
> > + intptr_t i = (intptr_t)dirp;
> > +
> > + if (i >= 0)
> > + return -1;
> > +
> > + return ~i;
>
> Might be better to use a different name for the variable.
> The two return statements look the same at a first glance.
yeah, I didn't notice it until you brought it up but 1 and i is
confusing. I guess I'll change i to fd.
Cheers,
Daniel