Patchwork [4/7] libext2fs: return written bytes in ext2fs_try_to_write_inline_data

login
register
mail settings
Submitter Zheng Liu
Date Nov. 15, 2012, 8:13 a.m.
Message ID <1352967209-29616-5-git-send-email-wenqing.lz@taobao.com>
Download mbox | patch
Permalink /patch/199209/
State New
Headers show

Comments

Zheng Liu - Nov. 15, 2012, 8:13 a.m.
From: Zheng Liu <wenqing.lz@taobao.com>

unwritten variable is assigned to the bytes of written data if writting to
inline data is done.  Otherwise, it will be assigned to 0.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
---
 lib/ext2fs/inline_data.c | 5 +++++
 1 file changed, 5 insertions(+)

Patch

diff --git a/lib/ext2fs/inline_data.c b/lib/ext2fs/inline_data.c
index 7f5ec3e..fd89360 100644
--- a/lib/ext2fs/inline_data.c
+++ b/lib/ext2fs/inline_data.c
@@ -890,6 +890,11 @@  errcode_t ext2fs_try_to_write_inline_data(ext2_filsys fs, ext2_ino_t ino,
 	retval = ext2fs_write_inode_full(fs, ino, (void *)inode,
 					 EXT2_INODE_SIZE(fs->super));
 
+	if (!retval)
+		*written = nbytes;
+	else
+		*written = 0;
+
 out:
 	ext2fs_free_mem(&inode);
 	return retval;