Skip to content
Snippets Groups Projects
Commit 6f830e08 authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Moved the error() calls out from THREADS_ALLOW/DISALLOW.

Rev: src/modules/files/efuns.c:1.9
parent eaf8d94f
No related branches found
No related tags found
No related merge requests found
......@@ -189,12 +189,14 @@ void f_get_dir(INT32 args)
struct dirent *tmp;
int num_files=0;
char *bufptr=buffer;
THREADS_ALLOW();
if (!(tmp = alloca(pathconf(path, _PC_NAME_MAX) + 1))) {
if (!(tmp = alloca(sizeof(struct dirent) +
pathconf(path, _PC_NAME_MAX) + 1))) {
error("get_dir(): Out of memory!\n");
}
THREADS_ALLOW();
while(1)
{
/* Should have code for the POSIX variant here also */
......@@ -202,7 +204,7 @@ void f_get_dir(INT32 args)
d=readdir_r(dir, tmp);
} while ((!d) && ((errno == EAGAIN)||(errno == EINTR)));
if (!d) {
error("get_dir(): readdir_r() failed: %d\n", errno);
break;
}
if(d->d_name[0]=='.')
{
......@@ -218,6 +220,9 @@ void f_get_dir(INT32 args)
num_files++;
}
THREADS_DISALLOW();
if (!d) {
error("get_dir(): readdir_r() failed: %d\n", errno);
}
for(e=0;e<num_files;e++)
{
push_string(make_shared_binary_string(ptrs[e],lens[e]));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment