Cygwin: change virtual_ftype_t to not rely on negative values
So far negative values were denoting files, positive values denoting directories. We should prefer a less error prone method. Redefine virtual_ftype_t to contain only positive values and replace checks for negativ or positive values with inline functions virt_ftype_isfile() and virt_ftype_isdir(). Drop outdcated comments referring to numerical virtual_ftype_t values. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
@ -45,7 +45,7 @@ fhandler_virtual::opendir (int fd)
|
||||
DIR *res = NULL;
|
||||
size_t len;
|
||||
|
||||
if (exists () <= 0)
|
||||
if (!virt_ftype_isdir (exists ()))
|
||||
set_errno (ENOTDIR);
|
||||
else if ((len = strlen (get_name ())) > PATH_MAX - 3)
|
||||
set_errno (ENAMETOOLONG);
|
||||
|
Reference in New Issue
Block a user