summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/syscalls.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-06-26 21:03:08 +0000
committerChristopher Faylor <me@cgf.cx>2001-06-26 21:03:08 +0000
commit07c3cd5bb1d74bd173c1b98501e3e77ff0ba862a (patch)
tree7b20c1eb9ef656c4678c3de46ff84114ddcff46e /winsup/cygwin/syscalls.cc
parent32c30349694070062428a8b52f362db45bf9d0c1 (diff)
downloadcygnal-07c3cd5bb1d74bd173c1b98501e3e77ff0ba862a.tar.gz
cygnal-07c3cd5bb1d74bd173c1b98501e3e77ff0ba862a.tar.bz2
cygnal-07c3cd5bb1d74bd173c1b98501e3e77ff0ba862a.zip
* fhandler.cc (fhandler_disk_file::fstat): Don't rely on exactly 3 characters
being read for executable test since we could be checking for less than that. * syscalls.cc (stat_worker): Try opening the file the "correct" way first so that #! processing can potentially happen. If that fails, then use "query open" method. * spawn.cc (spawn_guts): Delay processing of signal until after we've notified parent about reparenting.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 23b6540e3..8b1a41e1e 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -1069,9 +1069,16 @@ stat_worker (const char *caller, const char *name, struct stat *buf,
&& dtype != DRIVE_NO_ROOT_DIR
&& dtype != DRIVE_UNKNOWN)))
{
- fh.set_query_open (TRUE);
oret = fh.open (real_path, O_RDONLY | O_BINARY | O_DIROPEN |
(nofollow ? O_NOSYMLINK : 0), 0);
+ /* If we couldn't open the file, try a "query open" with no permissions.
+ This will allow us to determine *some* things about the file, at least. */
+ if (!oret)
+ {
+ fh.set_query_open (TRUE);
+ oret = fh.open (real_path, O_RDONLY | O_BINARY | O_DIROPEN |
+ (nofollow ? O_NOSYMLINK : 0), 0);
+ }
/* Check a special case here. If ntsec is ON it happens
that a process creates a file using mode 000 to disallow
other processes access. In contrast to UNIX, this results