From 018c672eb1f053d87b43ec8dcb9db3982fa9884e Mon Sep 17 00:00:00 2001
From: Nadav Har'El <nyh@cloudius-systems.com>
Date: Mon, 26 Aug 2013 12:56:05 +0300
Subject: [PATCH] __fxstat64: Don't check version argument

In Linux, _STAT_VER is 1 on 64-bit (and 3 on 32-bit), but glibc never
verifies the argument to __fxstat64. JNR - a library used by JRuby -
wrongly (I believe) passes ver==0 to __fxstat64
(see jnr-posix/..../LinuxPosix.java). On Linux this wrong argument is
ignored but in our implementation, fails the check.

So this patch removes this check from our code as well, to let JNR and
therefore JRuby which uses it, use stat without failing.
---
 fs/vfs/main.cc | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/vfs/main.cc b/fs/vfs/main.cc
index a1abda65a..09fce4954 100755
--- a/fs/vfs/main.cc
+++ b/fs/vfs/main.cc
@@ -427,9 +427,6 @@ int __fxstat(int ver, int fd, struct stat *st)
 	int error;
 
 	trace_vfs_fstat(fd, st);
-	error = ENOSYS;
-	if (ver != 1)
-		goto out_errno;
 
 	error = fget(fd, &fp);
 	if (error)
-- 
GitLab