mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 17:02:45 +00:00 
			
		
		
		
	Kernel+Tests: Remove inaccurate FIXME in sys$rmdir()
We were already handling the rmdir("..") case by refusing to remove
directories that were not empty.
This patch removes a FIXME from January 2019 and adds a test. :^)
			
			
This commit is contained in:
		
							parent
							
								
									8d781d0216
								
							
						
					
					
						commit
						8619f2c6f3
					
				
					 2 changed files with 19 additions and 2 deletions
				
			
		|  | @ -847,8 +847,6 @@ ErrorOr<void> VirtualFileSystem::rmdir(Credentials const& credentials, StringVie | ||||||
|     if (last_component == "."sv) |     if (last_component == "."sv) | ||||||
|         return EINVAL; |         return EINVAL; | ||||||
| 
 | 
 | ||||||
|     // FIXME: We should return ENOTEMPTY if the last component of the path is ".."
 |  | ||||||
| 
 |  | ||||||
|     if (!inode.is_directory()) |     if (!inode.is_directory()) | ||||||
|         return ENOTDIR; |         return ENOTDIR; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -337,6 +337,25 @@ TEST_CASE(rmdir_dot) | ||||||
|     EXPECT_EQ(rc, 0); |     EXPECT_EQ(rc, 0); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | TEST_CASE(rmdir_dot_dot) | ||||||
|  | { | ||||||
|  |     int rc = mkdir("/home/anon/rmdir-test-2", 0700); | ||||||
|  |     EXPECT_EQ(rc, 0); | ||||||
|  | 
 | ||||||
|  |     rc = mkdir("/home/anon/rmdir-test-2/foo", 0700); | ||||||
|  |     EXPECT_EQ(rc, 0); | ||||||
|  | 
 | ||||||
|  |     rc = rmdir("/home/anon/rmdir-test-2/foo/.."); | ||||||
|  |     EXPECT_NE(rc, 0); | ||||||
|  |     EXPECT_EQ(errno, ENOTEMPTY); | ||||||
|  | 
 | ||||||
|  |     rc = rmdir("/home/anon/rmdir-test-2/foo"); | ||||||
|  |     EXPECT_EQ(rc, 0); | ||||||
|  | 
 | ||||||
|  |     rc = rmdir("/home/anon/rmdir-test-2"); | ||||||
|  |     EXPECT_EQ(rc, 0); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| TEST_CASE(rmdir_while_inside_dir) | TEST_CASE(rmdir_while_inside_dir) | ||||||
| { | { | ||||||
|     int rc = mkdir("/home/anon/testdir", 0700); |     int rc = mkdir("/home/anon/testdir", 0700); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling