This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH-n] Add statx conditionals for wordsize-32 *xstat.c
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Mao Han <han_mao at c-sky dot com>
- Cc: <libc-alpha at sourceware dot org>, <c-sky_gcc_upstream at c-sky dot com>, <gnu-csky at mentor dot com>, <ren_guo at c-sky dot com>, <yibin_liu at c-sky dot com>
- Date: Wed, 5 Dec 2018 16:32:44 +0000
- Subject: Re: [PATCH-n] Add statx conditionals for wordsize-32 *xstat.c
- References: <cover.1543283180.git.han_mao@c-sky.com> <559e0c3f5b872cceb5ca1dab819c89b18dcc6322.1543283129.git.han_mao@c-sky.com>
On Thu, 29 Nov 2018, Mao Han wrote:
> +# ifdef __NR_fstat64
> int rc = INLINE_SYSCALL (fstat64, 2, fd, buf);
> return rc ?: stat_overflow (buf);
> +# else
> + struct statx tmp;
> + int rc = INLINE_SYSCALL (statx, 5, fd, "", AT_EMPTY_PATH,
> + STATX_BASIC_STATS, &tmp);
> + if (rc == 0)
> + __cp_stat64_statx ((struct stat64 *)buf, &tmp);
> + return rc ?: stat_overflow (buf);
> +# endif
I think that in all these cases where overflow checks are needed, it would
be best for the "return rc ?: stat_overflow (buf);" to be outside the
#ifdef conditionals, because if it's needed with one syscall, it's needed
with both of them.
--
Joseph S. Myers
joseph@codesourcery.com