diff --git a/src/xpdev/filewrap.c b/src/xpdev/filewrap.c
index 2ebbb74c8fbc3c579e4c283188cf992a8528a3f4..7169e472a79f827c9b57797d10288988b43b8895 100644
--- a/src/xpdev/filewrap.c
+++ b/src/xpdev/filewrap.c
@@ -86,6 +86,11 @@ off_t DLLCALL filelength(int fd)
 	return(st.st_size);
 }
 
+// See https://patchwork.kernel.org/patch/9289177/
+#if defined(F_OFD_SETLK) && defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS != 64
+	#undef F_OFD_SETLK
+#endif
+
 /* Sets a lock on a portion of a file */
 int DLLCALL lock(int fd, off_t pos, off_t len)
 {