lkml.org 
[lkml]   [2000]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[FIX] fcntl F_GETLK returns error
Date
From
Hi,

Since fcntl64 went in, fcntl(fd, F_GETLK, ..) would
fail with EOVERFLOW if anyone had taken a lock on
the file that extended to the end of the file. This
patch fixes it (I think sanely).

Cheers,
Stephen
--
Stephen Rothwell, Open Source Researcher, Linuxcare, Inc.
+61-2-62628990 tel, +61-2-62628991 fax
sfr@linuxcare.com, http://www.linuxcare.com/
Linuxcare. Support for the revolution.

diff -ruN 2.4.0-test7pre5/fs/locks.c 2.4.0-test7pre5-getlk-fix/fs/locks.c
--- 2.4.0-test7pre5/fs/locks.c Fri Aug 18 17:54:26 2000
+++ 2.4.0-test7pre5-getlk-fix/fs/locks.c Mon Aug 21 11:51:45 2000
@@ -985,15 +985,14 @@
* legacy 32bit flock.
*/
error = -EOVERFLOW;
- if (fl->fl_end > OFFT_OFFSET_MAX)
+ if (fl->fl_start > OFFT_OFFSET_MAX)
+ goto out_putf;
+ if ((fl->fl_end != OFFSET_MAX)
+ && (fl->fl_end > OFFT_OFFSET_MAX))
goto out_putf;
#endif
flock.l_start = fl->fl_start;
-#if BITS_PER_LONG == 32
- flock.l_len = fl->fl_end == OFFT_OFFSET_MAX ? 0 :
-#else
flock.l_len = fl->fl_end == OFFSET_MAX ? 0 :
-#endif
fl->fl_end - fl->fl_start + 1;
flock.l_whence = 0;
flock.l_type = fl->fl_type;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 12:37    [W:0.038 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site