aboutsummaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-04-19 17:21:32 +0000
committerChristopher Faylor <me@cgf.cx>2012-04-19 17:21:32 +0000
commit080f275bae53c9a03c889014cdc42b02d7837448 (patch)
tree661a03e4fb2aa660fd58d0b903b770c1920ff507 /winsup
parent55dcba98dbd120db696fba3dda62a348599a2889 (diff)
downloadnewlib-080f275bae53c9a03c889014cdc42b02d7837448.zip
newlib-080f275bae53c9a03c889014cdc42b02d7837448.tar.gz
newlib-080f275bae53c9a03c889014cdc42b02d7837448.tar.bz2
* dtable.cc (fh_alloc): Keep fh which was flagged as error if it is for an
on-disk device and we were stating it. * path.cc (path_conv::check): Set PATH_KEPT_HANDLE. * path.h (path_types): Add PATH_KEPT_HANDLE. (path_conv::kept_handle): Implement.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog8
-rw-r--r--winsup/cygwin/dtable.cc11
-rw-r--r--winsup/cygwin/path.cc3
-rw-r--r--winsup/cygwin/path.h2
4 files changed, 22 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index c83267e..ac299a8 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,11 @@
+2012-04-19 Christopher Faylor <me.cygwin2012@cgf.cx>
+
+ * dtable.cc (fh_alloc): Keep fh which was flagged as error if it is for
+ an on-disk device and we were stating it.
+ * path.cc (path_conv::check): Set PATH_KEPT_HANDLE.
+ * path.h (path_types): Add PATH_KEPT_HANDLE.
+ (path_conv::kept_handle): Implement.
+
2012-04-18 Christopher Faylor <me.cygwin2012@cgf.cx>
* fhandler.h (fhandler_base::nohandle): Revert to standard
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 27e741c..c956ec3 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -607,8 +607,15 @@ fh_alloc (path_conv& pc)
fh = cnew (fhandler_nodevice);
else if (fh->dev () == FH_ERROR)
{
- delete fh;
- fh = NULL;
+ if (pc.kept_handle () && pc.dev.isfs ())
+ fh->dev () = pc.dev; /* Special case: This file actually exists on
+ disk and this is a stat() so just return the
+ info from pc. */
+ else
+ {
+ delete fh;
+ fh = NULL;
+ }
}
return fh;
}
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 3524c0c..0a2380b 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1152,6 +1152,9 @@ out:
if (opt & PC_CTTY)
path_flags |= PATH_CTTY;
+ if (opt & PC_KEEP_HANDLE)
+ path_flags |= PATH_KEPT_HANDLE;
+
if ((opt & PC_POSIX))
{
if (tail < path_end && tail > path_copy + 1)
diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h
index 3bbab4d..ff5585b 100644
--- a/winsup/cygwin/path.h
+++ b/winsup/cygwin/path.h
@@ -77,6 +77,7 @@ enum path_types
PATH_IHASH = MOUNT_IHASH,
PATH_ALL_EXEC = (PATH_CYGWIN_EXEC | PATH_EXEC),
PATH_NO_ACCESS_CHECK = PC_NO_ACCESS_CHECK,
+ PATH_KEPT_HANDLE = 0x00200000,
PATH_CTTY = 0x00400000, /* could later be used as ctty */
PATH_OPEN = 0x00800000, /* use open semantics */
PATH_LNK = 0x01000000,
@@ -153,6 +154,7 @@ class path_conv
bool has_acls () const {return !(path_flags & PATH_NOACL) && fs.has_acls (); }
bool hasgood_inode () const {return !(path_flags & PATH_IHASH); }
bool isgood_inode (__ino64_t ino) const;
+ bool kept_handle () const {return !!(path_flags & PATH_KEPT_HANDLE);}
int has_symlinks () const {return path_flags & PATH_HAS_SYMLINKS;}
int has_dos_filenames_only () const {return path_flags & PATH_DOS;}
int has_buggy_open () const {return fs.has_buggy_open ();}