From e065a187abb915c2a5e16d9b895b0319e13280df Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 2 Jun 2002 03:13:22 +0000 Subject: * 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. --- winsup/cygwin/fhandler_process.cc | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'winsup/cygwin/fhandler_process.cc') diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc index 3858a2116..35f1c7bb4 100644 --- a/winsup/cygwin/fhandler_process.cc +++ b/winsup/cygwin/fhandler_process.cc @@ -87,7 +87,7 @@ fhandler_process::exists () for (int i = 0; process_listing[i]; i++) if (pathmatch (path + 1, process_listing[i])) return -1; - return 1; + return 0; } fhandler_process::fhandler_process (): @@ -104,20 +104,13 @@ fhandler_process::fstat (struct __stat64 *buf, path_conv *pc) path += proc_len + 1; int pid = atoi (path); winpids pids; - _pinfo *p; - for (unsigned i = 0; i < pids.npids; i++) + pinfo p (pid); + if (!p) { - p = pids[i]; - - if (!proc_exists (p)) - continue; - - if (p->pid == pid) - goto found; + set_errno(ENOENT); + return -1; } - set_errno(ENOENT); - return -1; -found: + buf->st_mode &= ~_IFMT & NO_W; switch (file_type) -- cgit v1.2.3