The substance of the change seems fine. It needs a proper ChangeLog entry.
See the glibc wiki for full instructions on posting patches.
> + struct stat64 st;
> + int r = fd >= 0 ? fstat64(fd, &st) : stat64(name, &st);
Put space before paren in those calls.
It's shorter and more common to invert the sense and use < 0.
> + if (r == -1)
> return 0;
There is no need for a variable here.
Also, it's more usual to test for failure with < 0:
if ((fd < 0 ? stat64 (name, &st) : fstat64 (fd, &st)) < 0)
return 0;
Thanks,
Roland