Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-06-02 07:13:22 +0400
committerChristopher Faylor <me@cgf.cx>2002-06-02 07:13:22 +0400
commite065a187abb915c2a5e16d9b895b0319e13280df (patch)
treee04b2705f03b4b616b31240a653bb74b3289929c /winsup/cygwin/syscalls.cc
parent415f62a72c1ceb533da53f6b3829e6b1782ee2d4 (diff)
* fhandler.cc (fhandler_base::fstat): Move dev and ino calculation into caller.
* syscalls.cc (stat_worker): Calculate dev and ino calculation here, if zero. * fhandler_proc.cc (fhandler_proc::fhandler_proc): Minor reorg for debugging. * fhandler_process.cc (fhandler_process::exists): Return 0 on nonexistence. (fhandler_process::fstat): Simplify pid logic. * fhandler_tape.cc (fhandler_dev_tape::fstat): Minor reformatting.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc22
1 files changed, 14 insertions, 8 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 969389f31..a936a21fd 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -1073,18 +1073,17 @@ stat_worker (const char *name, struct __stat64 *buf, int nofollow,
path_conv real_path;
fhandler_base *fh = NULL;
- if (!pc)
- pc = &real_path;
-
- MALLOC_CHECK;
if (check_null_invalid_struct_errno (buf))
goto done;
+ if (!pc)
+ pc = &real_path;
+
fh = cygheap->fdtab.build_fhandler_from_name (-1, name, NULL, *pc,
- (nofollow ?
- PC_SYM_NOFOLLOW
- : PC_SYM_FOLLOW)
+ (nofollow ? PC_SYM_NOFOLLOW
+ : PC_SYM_FOLLOW)
| PC_FULL, stat_suffixes);
+
if (pc->error)
{
debug_printf ("got %d error from build_fhandler_from_name", pc->error);
@@ -1094,8 +1093,15 @@ stat_worker (const char *name, struct __stat64 *buf, int nofollow,
{
debug_printf ("(%s, %p, %d, %p), file_attributes %d", name, buf, nofollow,
pc, (DWORD) real_path);
- memset (buf, 0, sizeof (struct __stat64));
+ memset (buf, 0, sizeof (*buf));
res = fh->fstat (buf, pc);
+ if (!res)
+ {
+ if (!buf->st_ino)
+ buf->st_ino = hash_path_name (0, fh->get_win32_name ());
+ if (!buf->st_dev)
+ buf->st_dev = FHDEVN (fh->get_device ()) << 8 | (fh->get_unit () & 0xff);
+ }
}
done: