[lkml]   [1996]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message


The modification to locks.c in Alan's patches breaks sendmail, and
possibly other applications as well. The author of the patch had good
intentions (avoid random users locking files they cannot open in writing),
however there is too much broken software out there which assumes that
flock will work with a r/o file descriptor.

The following patch does pretty much the same thing, but in a more
conservative way.


It is better to keep your mouth shut and be thought a fool,
than to open it and remove all doubt.

--- linux/fs/locks.c.old Wed Dec 4 23:16:57 1996
+++ linux/fs/locks.c Wed Dec 4 23:14:25 1996
@@ -242,9 +242,14 @@
struct file_lock file_lock;
struct file *filp;
+ int err;

if ((fd >= NR_OPEN) || !(filp = current->files->fd[fd]))
return (-EBADF);
+ err = permission(filp->f_inode, S_IWOTH);
+ if (err)
+ return err;

if (!flock_make_lock(filp, &file_lock, cmd))
return (-EINVAL);

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