From d61925786a19f2ee513c969ad7cb421a7db762b7 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 27 Feb 2005 04:30:08 +0000 Subject: [PATCH] * sigproc.cc (_pinfo::set_ctty): Move function * pinfo.cc (_pinfo::set_ctty): to here. * fhandler_mem.cc (fhandler_dev_mem::fstat): Don't fill out structure if this is an on-disk device rather than an "auto" device. * fhandler_raw.cc (fhandler_dev_raw::fstat): Ditto. * path.cc (normalize_posix_path): Don't treat a standalone '//' as introducing a UNC path. (normalize_win32_path): Ditto. --- winsup/cygwin/ChangeLog | 13 +++++++++++++ winsup/cygwin/fhandler_mem.cc | 13 ++++++++----- winsup/cygwin/fhandler_raw.cc | 26 +++++++++++++++----------- winsup/cygwin/path.cc | 4 ++-- winsup/cygwin/pinfo.cc | 8 ++++++++ winsup/cygwin/sigproc.cc | 8 -------- 6 files changed, 46 insertions(+), 26 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 71694c9dc..8fbc41932 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,16 @@ +2005-02-26 Christopher Faylor + + * sigproc.cc (_pinfo::set_ctty): Move function + * pinfo.cc (_pinfo::set_ctty): to here. + + * fhandler_mem.cc (fhandler_dev_mem::fstat): Don't fill out structure + if this is an on-disk device rather than an "auto" device. + * fhandler_raw.cc (fhandler_dev_raw::fstat): Ditto. + + * path.cc (normalize_posix_path): Don't treat a standalone '//' as + introducing a UNC path. + (normalize_win32_path): Ditto. + 2005-02-26 Christopher Faylor * debug.cc (delete_handle): Report on handle value in debugging output. diff --git a/winsup/cygwin/fhandler_mem.cc b/winsup/cygwin/fhandler_mem.cc index 4c873d758..296ef8693 100644 --- a/winsup/cygwin/fhandler_mem.cc +++ b/winsup/cygwin/fhandler_mem.cc @@ -402,12 +402,15 @@ int fhandler_dev_mem::fstat (struct __stat64 *buf) { fhandler_base::fstat (buf); - buf->st_mode = S_IFCHR; - if (wincap.has_physical_mem_access ()) - buf->st_mode |= S_IRUSR | S_IWUSR | - S_IRGRP | S_IWGRP | - S_IROTH | S_IWOTH; buf->st_blksize = getpagesize (); + if (is_auto_device ()) + { + buf->st_mode = S_IFCHR; + if (wincap.has_physical_mem_access ()) + buf->st_mode |= S_IRUSR | S_IWUSR | + S_IRGRP | S_IWGRP | + S_IROTH | S_IWOTH; + } return 0; } diff --git a/winsup/cygwin/fhandler_raw.cc b/winsup/cygwin/fhandler_raw.cc index 4ce444c1b..e1ab19a07 100644 --- a/winsup/cygwin/fhandler_raw.cc +++ b/winsup/cygwin/fhandler_raw.cc @@ -86,17 +86,21 @@ fhandler_dev_raw::fstat (struct __stat64 *buf) { debug_printf ("here"); - if (get_major () == DEV_TAPE_MAJOR) - buf->st_mode = S_IFCHR | STD_RBITS | STD_WBITS | S_IWGRP | S_IWOTH; - else - buf->st_mode = S_IFBLK | STD_RBITS | STD_WBITS | S_IWGRP | S_IWOTH; - - buf->st_uid = geteuid32 (); - buf->st_gid = getegid32 (); - buf->st_nlink = 1; - buf->st_blksize = S_BLKSIZE; - time_as_timestruc_t (&buf->st_ctim); - buf->st_atim = buf->st_mtim = buf->st_ctim; + fhandler_base::fstat (buf); + if (is_auto_device ()) + { + if (get_major () == DEV_TAPE_MAJOR) + buf->st_mode = S_IFCHR | STD_RBITS | STD_WBITS | S_IWGRP | S_IWOTH; + else + buf->st_mode = S_IFBLK | STD_RBITS | STD_WBITS | S_IWGRP | S_IWOTH; + + buf->st_uid = geteuid32 (); + buf->st_gid = getegid32 (); + buf->st_nlink = 1; + buf->st_blksize = S_BLKSIZE; + time_as_timestruc_t (&buf->st_ctim); + buf->st_atim = buf->st_mtim = buf->st_ctim; + } return 0; } diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 0615077b8..10a174838 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -230,7 +230,7 @@ normalize_posix_path (const char *src, char *dst, char *&tail) *tail++ = '/'; } /* Two leading /'s? If so, preserve them. */ - else if (isslash (src[1]) && !isslash (src[2])) + else if (isslash (src[1]) && src[2] && !isslash (src[2])) { *tail++ = '/'; *tail++ = '/'; @@ -1023,7 +1023,7 @@ normalize_win32_path (const char *src, char *dst, char *&tail) bool beg_src_slash = isdirsep (src[0]); tail = dst; - if (beg_src_slash && isdirsep (src[1])) + if (beg_src_slash && isdirsep (src[1]) && src[2]) { *tail++ = '\\'; src++; diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index 671c3c4e3..b77b4c0d2 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -373,6 +373,14 @@ _pinfo::set_ctty (tty_min *tc, int flags, fhandler_tty_slave *arch) } } +/* Test to determine if a process really exists and is processing signals. + */ +bool __stdcall +_pinfo::exists () +{ + return this && !(process_state & PID_EXITED); +} + bool _pinfo::alive () { diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 66e7395ab..c85847e10 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -195,14 +195,6 @@ pid_exists (pid_t pid) return pinfo (pid)->exists (); } -/* Test to determine if a process really exists and is processing signals. - */ -bool __stdcall -_pinfo::exists () -{ - return this && !(process_state & PID_EXITED); -} - /* Return true if this is one of our children, false otherwise. */ static inline bool __stdcall mychild (int pid) -- 2.43.5