From fdf0b5de282128ded84921263ceb35d634a9dbbd Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 30 Jun 2002 23:02:58 +0000 Subject: * fhandler.h (fhandler_process::pid): New field. (fhandler_process::fstat): Remove unneeded array. Set pid element. (fhandler_process::open): Ditto. (fhandler_process::fill_filebuf): Handle case where 'p' field is NULL. --- winsup/cygwin/fhandler_process.cc | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'winsup/cygwin/fhandler_process.cc') diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc index f2b896314..a0ba4af90 100644 --- a/winsup/cygwin/fhandler_process.cc +++ b/winsup/cygwin/fhandler_process.cc @@ -100,12 +100,11 @@ fhandler_process::fstat (struct __stat64 *buf, path_conv *pc) int file_type = exists (); (void) fhandler_base::fstat (buf, pc); path += proc_len + 1; - int pid = atoi (path); - winpids pids; + pid = atoi (path); pinfo p (pid); if (!p) { - set_errno(ENOENT); + set_errno (ENOENT); return -1; } @@ -154,8 +153,7 @@ fhandler_process::readdir (DIR * dir) int fhandler_process::open (path_conv *pc, int flags, mode_t mode) { - int process_file_no = -1, pid; - winpids pids; + int process_file_no = -1; int res = fhandler_virtual::open (pc, flags, mode); if (!res) @@ -249,6 +247,17 @@ out: void fhandler_process::fill_filebuf () { + pinfo pmaybe; + + if (!p) + { + pmaybe.init (pid); + p = &pmaybe; + } + + if (!p) + return; + switch (fileid) { case PROCESS_UID: @@ -349,6 +358,9 @@ fhandler_process::fill_filebuf () break; } } + + if (p == &pmaybe) + p = NULL; } static -- cgit v1.2.3