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:
Axel Dörfler 2003-08-18 02:08:58 +00:00
parent a4cd9d18a1
commit f3514075a1

View File

@ -30,11 +30,13 @@ opendir(const char *path)
DIR *dir;
int fd = sys_open_dir(path);
if (fd < 0)
if (fd < 0) {
errno = fd;
return NULL;
}
/* 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;
sys_close(fd);
return NULL;