From 41c26786e7f1a96cd7c68207fab940eb32930ff0 Mon Sep 17 00:00:00 2001 From: lind Date: Wed, 23 Oct 2024 17:19:01 +0000 Subject: [PATCH] fix: test case ut_lind_fs_link_invalid_path_permissions --- src/tests/fs_tests.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tests/fs_tests.rs b/src/tests/fs_tests.rs index ffb7c22..1aa678d 100644 --- a/src/tests/fs_tests.rs +++ b/src/tests/fs_tests.rs @@ -1764,6 +1764,8 @@ pub mod fs_tests { // Create the directory for the oldpath with the parent not having read // permission. Currently assigning "Write only" permissions + // Remove the directory if it already exists + let _ = cage.rmdir_syscall("/invalidtestdir"); assert_eq!(cage.mkdir_syscall("/invalidtestdir", 0o200), 0); assert_eq!( cage.open_syscall(oldpath, O_CREAT | O_EXCL | O_WRONLY, 0o200), @@ -1777,7 +1779,8 @@ pub mod fs_tests { cage.link_syscall(oldpath, newpath), -(Errno::EACCES as i32) ); - + // Cleanup the directory to ensure clean environment + assert_eq!(cage.rmdir_syscall("/invalidtestdir"), 0); assert_eq!(cage.exit_syscall(libc::EXIT_SUCCESS), libc::EXIT_SUCCESS); lindrustfinalize(); }