mescc: Mes C Library: Fix access stub.
* lib/stub/access.c (access): Use _open3 to give more meaningful behaviour. Fixes hanging of mes.
This commit is contained in:
parent
7c6da0c213
commit
f5bf3f4cf6
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include <mes/lib.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int
|
||||
access (char const *file_name, int how)
|
||||
|
@ -29,5 +31,15 @@ access (char const *file_name, int how)
|
|||
eputs ("access stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
if (how == R_OK || how == F_OK)
|
||||
{
|
||||
int filedes = _open3 (file_name, O_RDONLY, 0);
|
||||
if (filedes >= 2)
|
||||
return 0;
|
||||
}
|
||||
else if (how == W_OK)
|
||||
return 0;
|
||||
else if (how == X_OK)
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue