about summary refs log tree commit diff stats
path: root/src/wrapped32
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-10-08 20:48:13 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-10-08 20:48:13 +0200
commitbb651298c4a42adc2912c95acc5d34075a8b8443 (patch)
tree4bced0859850367001d2caf69a74554a6cf7049b /src/wrapped32
parent8850a1107219024d5540c18d2dda18cdfaeaf73c (diff)
downloadbox64-bb651298c4a42adc2912c95acc5d34075a8b8443.tar.gz
box64-bb651298c4a42adc2912c95acc5d34075a8b8443.zip
[BOX32] Added better handling of fcntl (should help Wine when futex_waitv syscall is not available)
Diffstat (limited to 'src/wrapped32')
-rwxr-xr-xsrc/wrapped32/wrappedlibc.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/wrapped32/wrappedlibc.c b/src/wrapped32/wrappedlibc.c
index 418430d9..5a829510 100755
--- a/src/wrapped32/wrappedlibc.c
+++ b/src/wrapped32/wrappedlibc.c
@@ -2120,12 +2120,20 @@ EXPORT int32_t my32_fcntl64(x64emu_t* emu, int32_t a, int32_t b, uint32_t d1, ui
         d1 = of_convert32(d1);
     if(b==F_GETLK64 || b==F_SETLK64 || b==F_SETLKW64)
     {
-        my_flock64_t fl;
+        my_flock64_t fl = {0};
         AlignFlock64_32(&fl, from_ptrv(d1));
         int ret = fcntl(a, b, &fl);
         UnalignFlock64_32(from_ptrv(d1), &fl);
         return ret;
     }
+    if(b==F_GETLK || b==F_SETLK || b==F_SETLKW)
+    {
+        struct flock fl = {0};
+        AlignFlock_32(&fl, from_ptrv(d1));
+        int ret = fcntl(a, b, &fl);
+        UnalignFlock_32(from_ptrv(d1), &fl);
+        return ret;
+    }
     //TODO: check if better to use the syscall or regular fcntl?
     //return syscall(__NR_fcntl64, a, b, d1);   // should be enough
     int ret = fcntl(a, b, d1);
@@ -2151,12 +2159,20 @@ EXPORT int32_t my32_fcntl(x64emu_t* emu, int32_t a, int32_t b, uint32_t d1, uint
         d1 = of_convert32(d1);
     if(b==F_GETLK64 || b==F_SETLK64 || b==F_SETLKW64)
     {
-        my_flock64_t fl;
+        my_flock64_t fl = {0};
         AlignFlock64_32(&fl, from_ptrv(d1));
         int ret = fcntl(a, b, &fl);
         UnalignFlock64_32(from_ptrv(d1), &fl);
         return ret;
     }
+    if(b==F_GETLK || b==F_SETLK || b==F_SETLKW)
+    {
+        struct flock fl = {0};
+        AlignFlock_32(&fl, from_ptrv(d1));
+        int ret = fcntl(a, b, &fl);
+        UnalignFlock_32(from_ptrv(d1), &fl);
+        return ret;
+    }
     int ret = fcntl(a, b, d1);
     if(b==F_GETFL && ret!=-1)
         ret = of_unconvert32(ret);