fix . and .. incorrectly being reported as files
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				BlockStorage/repertory/pipeline/head This commit looks good
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	BlockStorage/repertory/pipeline/head This commit looks good
				
			This commit is contained in:
		| @@ -382,7 +382,7 @@ auto remote_fuse_drive::readdir_impl(std::string api_path, void *buf, | |||||||
|                                      fuse_fill_dir_t fuse_fill_dir, |                                      fuse_fill_dir_t fuse_fill_dir, | ||||||
|                                      off_t offset, |                                      off_t offset, | ||||||
|                                      struct fuse_file_info *f_info, |                                      struct fuse_file_info *f_info, | ||||||
|                                      fuse_readdir_flags /*flags*/) |                                      fuse_readdir_flags /* flags */) | ||||||
|     -> api_error { |     -> api_error { | ||||||
| #else  // FUSE_USE_VERSION < 30 | #else  // FUSE_USE_VERSION < 30 | ||||||
| auto remote_fuse_drive::readdir_impl(std::string api_path, void *buf, | auto remote_fuse_drive::readdir_impl(std::string api_path, void *buf, | ||||||
| @@ -397,26 +397,30 @@ auto remote_fuse_drive::readdir_impl(std::string api_path, void *buf, | |||||||
|   while ((res = remote_instance_->fuse_readdir( |   while ((res = remote_instance_->fuse_readdir( | ||||||
|               api_path.c_str(), static_cast<remote::file_offset>(offset), |               api_path.c_str(), static_cast<remote::file_offset>(offset), | ||||||
|               f_info->fh, item_path)) == 0) { |               f_info->fh, item_path)) == 0) { | ||||||
|     auto stat_res{0}; |  | ||||||
|     std::unique_ptr<struct stat> p_stat{nullptr}; |     std::unique_ptr<struct stat> p_stat{nullptr}; | ||||||
|  |     int stat_res{0}; | ||||||
|     if ((item_path == ".") || (item_path == "..")) { |     if ((item_path == ".") || (item_path == "..")) { | ||||||
|       p_stat = std::make_unique<struct stat>(); |       p_stat = std::make_unique<struct stat>(); | ||||||
|       std::memset(p_stat.get(), 0, sizeof(struct stat)); |       std::memset(p_stat.get(), 0, sizeof(struct stat)); | ||||||
|       if (item_path == ".") { |       if (item_path == ".") { | ||||||
|         stat_res = stat(get_mount_location().c_str(), p_stat.get()); |         stat_res = | ||||||
|  |             stat(utils::path::combine(get_mount_location(), {api_path}).c_str(), | ||||||
|  |                  p_stat.get()); | ||||||
|       } else { |       } else { | ||||||
|         stat_res = |         stat_res = | ||||||
|             stat(utils::path::get_parent_path(get_mount_location()).c_str(), |             stat(utils::path::get_parent_path( | ||||||
|  |                      utils::path::combine(get_mount_location(), {api_path})) | ||||||
|  |                      .c_str(), | ||||||
|                  p_stat.get()); |                  p_stat.get()); | ||||||
|       } |       } | ||||||
|     } else { |  | ||||||
|       item_path = utils::path::strip_to_file_name(item_path); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|       if (stat_res != 0) { |       if (stat_res != 0) { | ||||||
|         res = stat_res; |         res = stat_res; | ||||||
|         break; |         break; | ||||||
|       } |       } | ||||||
|  |     } else { | ||||||
|  |       item_path = utils::path::strip_to_file_name(item_path); | ||||||
|  |     } | ||||||
|  |  | ||||||
| #if FUSE_USE_VERSION >= 30 | #if FUSE_USE_VERSION >= 30 | ||||||
|     if (fuse_fill_dir(buf, item_path.c_str(), p_stat.get(), ++offset, |     if (fuse_fill_dir(buf, item_path.c_str(), p_stat.get(), ++offset, | ||||||
| @@ -426,11 +430,11 @@ auto remote_fuse_drive::readdir_impl(std::string api_path, void *buf, | |||||||
| #endif // FUSE_USE_VERSION >= 30 | #endif // FUSE_USE_VERSION >= 30 | ||||||
|       break; |       break; | ||||||
|     } |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|   if (res == -120) { |   if (res == -120) { | ||||||
|     res = 0; |     res = 0; | ||||||
|   } |   } | ||||||
|   } |  | ||||||
|  |  | ||||||
|   return utils::to_api_error(res); |   return utils::to_api_error(res); | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user