Use DT_UNKNOWN when dirent d_type extension is not supported.
edolstra: “…since callers of readDirectory have to handle the possibility of DT_UNKNOWN anyway, and we don't want to do a stat call for every directory entry unless it's really needed.”
This commit is contained in:
		
							parent
							
								
									cdb346c65e
								
							
						
					
					
						commit
						69b9d8fdbd
					
				
					 1 changed files with 1 additions and 5 deletions
				
			
		|  | @ -232,11 +232,7 @@ DirEntries readDirectory(const Path & path) | |||
|         checkInterrupt(); | ||||
|         string name = dirent->d_name; | ||||
|         if (name == "." || name == "..") continue; | ||||
| #ifdef HAVE_STRUCT_DIRENT_D_TYPE | ||||
|         entries.emplace_back(name, dirent->d_ino, dirent->d_type); | ||||
| #else | ||||
|         entries.emplace_back(name, dirent->d_ino, getFileType(absPath(name, path))); | ||||
| #endif | ||||
|         entries.emplace_back(name, dirent->d_ino, #ifdef HAVE_STRUCT_DIRENT_D_TYPE dirent->d_type #else DT_UNKNOWN #endif); | ||||
|     } | ||||
|     if (errno) throw SysError(format("reading directory ‘%1%’") % path); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue