opendir() did not correctly set "errno" if sys_open_dir() failed.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4297 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
a4cd9d18a1
commit
f3514075a1
@ -30,11 +30,13 @@ opendir(const char *path)
|
|||||||
DIR *dir;
|
DIR *dir;
|
||||||
|
|
||||||
int fd = sys_open_dir(path);
|
int fd = sys_open_dir(path);
|
||||||
if (fd < 0)
|
if (fd < 0) {
|
||||||
|
errno = fd;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* allocate the memory for the DIR structure */
|
/* allocate the memory for the DIR structure */
|
||||||
if ((dir = (DIR*)malloc(sizeof(DIR) + BUFFER_SIZE)) == NULL) {
|
if ((dir = (DIR *)malloc(sizeof(DIR) + BUFFER_SIZE)) == NULL) {
|
||||||
errno = B_NO_MEMORY;
|
errno = B_NO_MEMORY;
|
||||||
sys_close(fd);
|
sys_close(fd);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user