mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] 0 byte writes should not seek even with O_APPEND
@ 2000-11-20  7:43 Christopher Yeoh
  0 siblings, 0 replies; only message in thread
From: Christopher Yeoh @ 2000-11-20  7:43 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel

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/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-11-20  8:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-11-20  7:43 [PATCH] 0 byte writes should not seek even with O_APPEND Christopher Yeoh

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®