* sigproc.h (set_signal_mask): Remove default on second parameter and make pass
by reference. * signal.cc (abort): Accommodate change to set_signal_mask. * select.cc (pselect): Ditto. * exceptions.cc (handle_sigsuspend): Ditto. (ctrl_c_handler): Ditto. (sighold): Ditto. (sigrelse): Ditto. (set_process_mask_delta): Ditto. (_cygtls::call_signal_handler): Ditto. * fhandler_disk_file.cc (fhandler_disk_file::readdir): Return ENMFILE if __handle is not set. Set __handle to NULL when out of files. (fhandler_disk_file::rewinddir): Don't close handle if it's NULL. (fhandler_disk_file::closedir): Ditto.
This commit is contained in:
@ -1355,6 +1355,11 @@ fhandler_disk_file::readdir (DIR *dir, dirent *de)
|
||||
HANDLE handle;
|
||||
int res;
|
||||
|
||||
if (!dir->__handle)
|
||||
{
|
||||
res = ENMFILE;
|
||||
goto out;
|
||||
}
|
||||
if (dir->__handle == INVALID_HANDLE_VALUE && dir->__d_position == 0)
|
||||
{
|
||||
handle = FindFirstFileA (dir->__d_dirname, &buf);
|
||||
@ -1399,11 +1404,8 @@ fhandler_disk_file::readdir (DIR *dir, dirent *de)
|
||||
else
|
||||
{
|
||||
res = geterrno_from_win_error ();
|
||||
if (res != ENMFILE)
|
||||
{
|
||||
FindClose (dir->__handle);
|
||||
dir->__handle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
FindClose (dir->__handle);
|
||||
dir->__handle = NULL;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@ -1469,7 +1471,8 @@ fhandler_disk_file::rewinddir (DIR *dir)
|
||||
{
|
||||
if (dir->__handle != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
FindClose (dir->__handle);
|
||||
if (dir->__handle)
|
||||
FindClose (dir->__handle);
|
||||
dir->__handle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
dir->__d_position = 0;
|
||||
@ -1479,8 +1482,8 @@ int
|
||||
fhandler_disk_file::closedir (DIR *dir)
|
||||
{
|
||||
int res = 0;
|
||||
if (dir->__handle != INVALID_HANDLE_VALUE &&
|
||||
FindClose (dir->__handle) == 0)
|
||||
if (dir->__handle && dir->__handle != INVALID_HANDLE_VALUE
|
||||
&& FindClose (dir->__handle) == 0)
|
||||
{
|
||||
__seterrno ();
|
||||
res = -1;
|
||||
|
Reference in New Issue
Block a user