This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH-n] Add statx conditionals for wordsize-32 *xstat.c


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]