lkml.org 
[lkml]   [2002]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH] fcntl fix
People asked me to document that Linux has a non-POSIX-compliant
fcntl system call. Maybe fixing fcntl is better.
No doubt the same patch should be applied to 2.2 and 2.4,
but let's do 2.5 first.

--- /linux/2.5/linux-2.5.18/linux/fs/locks.c Tue May 21 07:07:37 2002
+++ /linux/2.5/linux-2.5.18a/linux/fs/locks.c Mon May 27 17:25:33 2002
@@ -274,9 +274,18 @@
return -EINVAL;
}

- if (((start += l->l_start) < 0) || (l->l_len < 0))
+ /* POSIX-1996 leaves the case l->l_len < 0 undefined;
+ POSIX-2001 defines it. */
+ start += l->l_start;
+ if (l->l_len < 0) {
+ end = start - 1;
+ start += l->l_len;
+ } else {
+ end = start + l->l_len - 1;
+ }
+
+ if (start < 0)
return -EINVAL;
- end = start + l->l_len - 1;
if (l->l_len > 0 && end < 0)
return -EOVERFLOW;
fl->fl_start = start; /* we record the absolute position */
Andries
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:26    [W:0.051 / U:1.744 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site