This is an automated email from the ASF dual-hosted git repository.

rduan pushed a commit to branch v2.0.0-preview
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-sgx-sdk.git


The following commit(s) were added to refs/heads/v2.0.0-preview by this push:
     new 43105575 Fix sgx_tprotected_fs rename
43105575 is described below

commit 431055754daca647e19df2b778079030ebaa8569
Author: sunhe05 <[email protected]>
AuthorDate: Fri Dec 9 04:36:13 2022 +0000

    Fix sgx_tprotected_fs rename
---
 sgx_protected_fs/tfs/src/sys/file/other.rs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sgx_protected_fs/tfs/src/sys/file/other.rs 
b/sgx_protected_fs/tfs/src/sys/file/other.rs
index 6d14ab89..2e2fa918 100644
--- a/sgx_protected_fs/tfs/src/sys/file/other.rs
+++ b/sgx_protected_fs/tfs/src/sys/file/other.rs
@@ -179,7 +179,7 @@ impl FileInner {
         ensure!(old_len > 0, eos!(EINVAL));
         ensure!(old_len < FILENAME_MAX_LEN - 1, eos!(ENAMETOOLONG));
 
-        let new_len = old_name.len();
+        let new_len = new_name.len();
         ensure!(new_len > 0, eos!(EINVAL));
         ensure!(new_len < FILENAME_MAX_LEN - 1, eos!(ENAMETOOLONG));
 
@@ -189,6 +189,7 @@ impl FileInner {
         self.metadata.encrypted_plain.file_name.fill(0);
         
self.metadata.encrypted_plain.file_name[0..new_len].copy_from_slice(new_name.as_bytes());
 
+        self.need_writing = true;
         Ok(())
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to