diff options
Diffstat (limited to 'ports/unix/guts/opendir.c')
-rw-r--r-- | ports/unix/guts/opendir.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ports/unix/guts/opendir.c b/ports/unix/guts/opendir.c index 8eaa71f..e69717e 100644 --- a/ports/unix/guts/opendir.c +++ b/ports/unix/guts/opendir.c @@ -6,8 +6,25 @@ * wrap_opendir(const char *path) { * DIR * rc = NULL; */ + struct stat buf; + int save_errno; rc = real_opendir(path); + if (rc) { + int fd; + save_errno = errno; + fd = dirfd(rc); + if (real_fstat(fd, &buf) == -1) { + pseudo_debug(1, "diropen (fd %d) succeeded, but fstat failed (%s).\n", + fd, strerror(errno)); + pseudo_client_op_plain(OP_OPEN, PSA_READ, fd, -1, path, 0); + } else { + pseudo_client_op_plain(OP_OPEN, PSA_READ, fd, -1, path, &buf); + } + + + errno = save_errno; + } /* return rc; * } |