linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christopher Yeoh <cyeoh@linuxcare.com.au>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] 0 byte writes should not seek even with O_APPEND
Date: Mon, 20 Nov 2000 18:43:23 +1100 (EST)	[thread overview]
Message-ID: <14872.54811.197665.178878@rockhopper.linuxcare.com.au> (raw)

Hi Linus,

Currently when a zero byte write is done on a regular file
opened with O_APPEND the file offset is set to the end of the
file. For POSIX compliant behaviour this shouldn't happen.

The attached patch fixes this.

Chris.

--- mm/filemap.c.orig	Mon Nov 20 14:05:38 2000
+++ mm/filemap.c	Mon Nov 20 18:11:43 2000
@@ -2458,12 +2458,15 @@
 		}
 	}
 
-	status  = 0;
-	if (count) {
-		remove_suid(inode);
-		inode->i_ctime = inode->i_mtime = CURRENT_TIME;
-		mark_inode_dirty(inode);
+	if (count == 0) {
+		err = 0;
+		goto out;
 	}
+
+	status  = 0;
+	remove_suid(inode);
+	inode->i_ctime = inode->i_mtime = CURRENT_TIME;
+	mark_inode_dirty(inode);
 
 	while (count) {
 		unsigned long bytes, index, offset;
-
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/

                 reply	other threads:[~2000-11-20  8:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14872.54811.197665.178878@rockhopper.linuxcare.com.au \
    --to=cyeoh@linuxcare.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).