Bugfix: When a broken symlink was found in a directory, the

directory list operation was aborted. This lead to empty directories,
or directories with too few entries.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@697 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Peter Åstrand 2004-05-11 13:52:22 +00:00
parent efef8750a8
commit fbd632d425

20
disk.c
View File

@ -840,13 +840,23 @@ disk_query_directory(HANDLE handle, uint32 info_class, char *pattern, STREAM out
// Get information for directory entry
sprintf(fullpath, "%s/%s", dirname, pdirent->d_name);
/* JIF
printf("Stat: %s\n", fullpath); */
if (stat(fullpath, &fstat))
{
perror("stat");
out_uint8(out, 0);
return STATUS_ACCESS_DENIED;
switch (errno)
{
case ENOENT:
case ELOOP:
case EACCES:
/* These are non-fatal errors. */
memset(&fstat, 0, sizeof(fstat));
break;
default:
/* Fatal error. By returning STATUS_NO_SUCH_FILE,
the directory list operation will be aborted */
perror(fullpath);
out_uint8(out, 0);
return STATUS_NO_SUCH_FILE;
}
}
if (S_ISDIR(fstat.st_mode))