X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=fs%2Ffcntl.c;h=dc4a7007f4e742c4e30563db78b34bd21d39ab58;hb=e5ea0a9fca5612808839dd4bcc41c46fc02451f9;hp=5f96786d1c73dc6c9ac27565b521835f6fe5ff12;hpb=cf41f8ac386e8d62122e7e394b4c6b3e3ab30ede;p=karo-tx-linux.git diff --git a/fs/fcntl.c b/fs/fcntl.c index 5f96786d1c73..dc4a7007f4e7 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c @@ -208,8 +208,11 @@ static int setfl(int fd, struct file * filp, unsigned long arg) struct inode * inode = filp->f_dentry->d_inode; int error = 0; - /* O_APPEND cannot be cleared if the file is marked as append-only */ - if (!(arg & O_APPEND) && IS_APPEND(inode)) + /* + * O_APPEND cannot be cleared if the file is marked as append-only + * and the file is open for write. + */ + if (((arg ^ filp->f_flags) & O_APPEND) && IS_APPEND(inode)) return -EPERM; /* O_NOATIME can only be set by the owner or superuser */