From 22c80a2e9a204974de39744fd87bff1644f60786 Mon Sep 17 00:00:00 2001
From: Andreas Mohr <amohr@codeweavers.com>
Date: Fri, 12 Jan 2001 23:02:39 +0000
Subject: [PATCH] Workaround for SuSE 7 2.2.16 kernel bug.

---
 server/file.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/server/file.c b/server/file.c
index c5b5ca36a1b..543bfcd192c 100644
--- a/server/file.c
+++ b/server/file.c
@@ -342,7 +342,10 @@ static int set_file_pointer( handle_t handle, int *low, int *high, int whence )
     if ((result = lseek( file->obj.fd, *low, whence )) == -1)
     {
         /* Check for seek before start of file */
-        if ((errno == EINVAL) && (whence != SEEK_SET) && (*low < 0))
+
+        /* also check EPERM due to SuSE7 2.2.16 lseek() EPERM kernel bug */
+        if (((errno == EINVAL) || (errno == EPERM))
+            && (whence != SEEK_SET) && (*low < 0))
             set_error( 0xc0010000 | ERROR_NEGATIVE_SEEK /* FIXME */ );
         else
             file_set_error();
-- 
GitLab