diff options
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_readwrite.c | 7 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_readwrite.c | 9 |
2 files changed, 15 insertions, 1 deletions
diff --git a/sys/ufs/ext2fs/ext2fs_readwrite.c b/sys/ufs/ext2fs/ext2fs_readwrite.c index 9ae4322756f..30332a71ab5 100644 --- a/sys/ufs/ext2fs/ext2fs_readwrite.c +++ b/sys/ufs/ext2fs/ext2fs_readwrite.c @@ -195,6 +195,13 @@ ext2fs_write(v) panic("%s: mode", "ext2fs_write"); #endif + /* + * If writing 0 bytes, succeed and do not change + * update time or file offset (standards compliance) + */ + if (uio->uio_resid == 0) + return (0); + switch (vp->v_type) { case VREG: if (ioflag & IO_APPEND) diff --git a/sys/ufs/ufs/ufs_readwrite.c b/sys/ufs/ufs/ufs_readwrite.c index 5b562568de7..9e99f06dbf1 100644 --- a/sys/ufs/ufs/ufs_readwrite.c +++ b/sys/ufs/ufs/ufs_readwrite.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_readwrite.c,v 1.23 2001/12/19 08:58:07 art Exp $ */ +/* $OpenBSD: ufs_readwrite.c,v 1.24 2002/01/09 17:55:56 tholo Exp $ */ /* $NetBSD: ufs_readwrite.c,v 1.9 1996/05/11 18:27:57 mycroft Exp $ */ /*- @@ -204,6 +204,13 @@ WRITE(v) panic("%s: mode", WRITE_S); #endif + /* + * If writing 0 bytes, succeed and do not change + * update time or file offset (standards compliance) + */ + if (uio->uio_resid == 0) + return (0); + switch (vp->v_type) { case VREG: if (ioflag & IO_APPEND) |