* [PATCH] fcntl fix
@ 2002-05-27 15:46 Andries.Brouwer
0 siblings, 0 replies; only message in thread
From: Andries.Brouwer @ 2002-05-27 15:46 UTC (permalink / raw)
To: linux-kernel, torvalds
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-05-27 15:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-27 15:46 [PATCH] fcntl fix Andries.Brouwer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®