Przeglądaj źródła

if fcntl() is called with a 64bit command and LFS is enabled, pass the command along to fcntl64 instead of returning ENOSYS (error detected by LTP fcntl18)

Mike Frysinger 20 lat temu
rodzic
commit
226d4893c8
1 zmienionych plików z 12 dodań i 5 usunięć
  1. 12 5
      libc/sysdeps/linux/common/__syscall_fcntl.c

+ 12 - 5
libc/sysdeps/linux/common/__syscall_fcntl.c

@@ -11,10 +11,12 @@
 #include <stdarg.h>
 #include <stdarg.h>
 #include <fcntl.h>
 #include <fcntl.h>
 
 
-#define __NR___syscall_fcntl __NR_fcntl
 #ifdef __UCLIBC_HAS_LFS__
 #ifdef __UCLIBC_HAS_LFS__
-static inline
+extern int __libc_fcntl64(int fd, int cmd, long arg);
 #endif
 #endif
+
+#define __NR___syscall_fcntl __NR_fcntl
+static inline
 _syscall3(int, __syscall_fcntl, int, fd, int, cmd, long, arg);
 _syscall3(int, __syscall_fcntl, int, fd, int, cmd, long, arg);
 
 
 int __libc_fcntl(int fd, int cmd, ...)
 int __libc_fcntl(int fd, int cmd, ...)
@@ -22,13 +24,18 @@ int __libc_fcntl(int fd, int cmd, ...)
 	long arg;
 	long arg;
 	va_list list;
 	va_list list;
 
 
+	va_start(list, cmd);
+	arg = va_arg(list, long);
+	va_end(list);
+
 	if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) {
 	if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) {
+#ifdef __UCLIBC_HAS_LFS__
+		return __libc_fcntl64(fd, cmd, arg);
+#else
 		__set_errno(ENOSYS);
 		__set_errno(ENOSYS);
 		return -1;
 		return -1;
+#endif
 	}
 	}
-	va_start(list, cmd);
-	arg = va_arg(list, long);
-	va_end(list);
 	return (__syscall_fcntl(fd, cmd, arg));
 	return (__syscall_fcntl(fd, cmd, arg));
 }
 }