aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/sys/mmixware/access.c
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2007-06-10 12:54:35 +0000
committerHans-Peter Nilsson <hp@axis.com>2007-06-10 12:54:35 +0000
commit32f67ec6ff30838169d7ded39dcfd6a7706b36d7 (patch)
tree7166256990adaee6c00505600b132780df42193a /newlib/libc/sys/mmixware/access.c
parent6fb374754dff1fbbe28b513b57caedc62e9a7cee (diff)
downloadnewlib-32f67ec6ff30838169d7ded39dcfd6a7706b36d7.zip
newlib-32f67ec6ff30838169d7ded39dcfd6a7706b36d7.tar.gz
newlib-32f67ec6ff30838169d7ded39dcfd6a7706b36d7.tar.bz2
* libc/sys/mmixware/access.c (access): Do not try to use a magic
file-handle and a direct syscall, just use _open. * libc/sys/mmixware/sys/syscall.h (TMPFNO): Remove this magic file-handle. * libc/sys/mmixware/_exit.c (_exit): Update comment about passing on the exit value.
Diffstat (limited to 'newlib/libc/sys/mmixware/access.c')
-rw-r--r--newlib/libc/sys/mmixware/access.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/newlib/libc/sys/mmixware/access.c b/newlib/libc/sys/mmixware/access.c
index a7b6646..8927b91 100644
--- a/newlib/libc/sys/mmixware/access.c
+++ b/newlib/libc/sys/mmixware/access.c
@@ -1,6 +1,6 @@
/* access for MMIXware.
- Copyright (C) 2001 Hans-Peter Nilsson
+ Copyright (C) 2001, 2007 Hans-Peter Nilsson
Permission to use, copy, modify, and distribute this software is
freely granted, provided that the above copyright notice, this notice
@@ -24,18 +24,17 @@ access (const char *fn, int flags)
implementations. Opening a directory as a file usually works, so
let's try and open it and use the openability, regardless of what
kind of test or file it is. */
- long ret;
+ int fd;
/* We'll just assume that if we can open the file for reading, then it's
Z-able, no matter what Z was. */
- ret = TRAP3f (SYS_Fopen, TMPFNO, fn, BinaryRead);
- if (ret == 0)
+ fd = _open (fn, O_RDONLY);
+ if (fd >= 0)
{
/* Yes, this was readable. As in other simulator access functions,
we always return success in this case (though the others check
for directory access). */
- TRAP1f (SYS_Fclose, TMPFNO);
- return 0;
+ return _close (fd);
}
errno = EACCES;