diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 2002-01-09 17:55:57 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 2002-01-09 17:55:57 +0000 |
commit | 1ee63d720d68d40048a4404347bb52fcd55f4d21 (patch) | |
tree | b171edbdb568e7318131adc446503004e442b8d4 /sys/ufs/ext2fs | |
parent | 3725e700cec5208e3166f78ef0ad1f7c38a0f2f3 (diff) |
If a write(2) is done with a length of zero bytes, short-circuit and do not
update the modification time -- required by POSIX. ok millert@ drahn@
Diffstat (limited to 'sys/ufs/ext2fs')
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_readwrite.c | 7 |
1 files changed, 7 insertions, 0 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) |