This is an automated email from the ASF dual-hosted git repository.
GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 9661f5a381f fs/vfs: preserve the inode number across pseudorename
9661f5a381f is described below
commit 9661f5a381fe8385e331f461293d763fe1e3f19b
Author: guohao15 <[email protected]>
AuthorDate: Thu Nov 26 23:35:57 2026 +0800
fs/vfs: preserve the inode number across pseudorename
The inode number of source should not be changed after rename.
Copy i_ino when transferring the source inode state to the destination.
Otherwise stat and readdir report the number allocated for the new name,
even though rename keeps the same file identity.
Signed-off-by: guohao15 <[email protected]>
Signed-off-by: jingfei <[email protected]>
---
fs/vfs/fs_rename.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/vfs/fs_rename.c b/fs/vfs/fs_rename.c
index e64b1e2ac01..aae551ecba1 100644
--- a/fs/vfs/fs_rename.c
+++ b/fs/vfs/fs_rename.c
@@ -199,6 +199,7 @@ static int pseudorename(FAR const char *oldpath, FAR struct
inode *oldinode,
newinode->i_child = oldinode->i_child; /* Link to lower level inode */
newinode->i_flags = oldinode->i_flags; /* Flags for inode */
newinode->u.i_ops = oldinode->u.i_ops; /* Inode operations */
+ newinode->i_ino = oldinode->i_ino;
#ifdef CONFIG_PSEUDOFS_ATTRIBUTES
newinode->i_mode = oldinode->i_mode; /* Access mode flags */
newinode->i_owner = oldinode->i_owner; /* Owner */