summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-11-03 04:27:03 +0000
committerChristopher Faylor <me@cgf.cx>2000-11-03 04:27:03 +0000
commitbb5d559a73794be49fd63b97086bf7e982504399 (patch)
tree2ddb43199de5cf752e36a35cf06a51f7803f21dd /winsup/cygwin/fhandler.cc
parent6857eb1b3b79aa92498e6b9dded43ae4a8265669 (diff)
downloadcygnal-bb5d559a73794be49fd63b97086bf7e982504399.tar.gz
cygnal-bb5d559a73794be49fd63b97086bf7e982504399.tar.bz2
cygnal-bb5d559a73794be49fd63b97086bf7e982504399.zip
* pinfo.cc (pinfo::init): Reverse order of setting status and pid info in an
execed process to avoid a race. * sigproc.cc (wait_subproc): Print more info when a WFSO error occurs. * automode.c: New file. * syscalls.cc (close_all_files): Streamline slightly. * cygheap.cc (ccalloc): Clear *entire* allocated array.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r--winsup/cygwin/fhandler.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index d7015b7ab..3efd81efb 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -142,9 +142,6 @@ fhandler_base::get_readahead_into_buffer (char *buf, size_t buflen)
return copied_chars;
}
-/**********************************************************************/
-/* fhandler_base */
-
/* Record the file name.
Filenames are used mostly for debugging messages, and it's hoped that
in cases where the name is really required, the filename wouldn't ever
@@ -253,14 +250,17 @@ fhandler_base::get_default_fmode (int flags)
size_t nlen = strlen (get_name ());
unsigned accflags = ACCFLAGS (flags);
for (__cygwin_perfile *pf = perfile_table; pf->name; pf++)
- {
- size_t pflen = strlen (pf->name);
- const char *stem = get_name () + nlen - pflen;
- if (pflen > nlen || (stem != get_name () && !isdirsep (stem[-1])))
- continue;
- else if (ACCFLAGS (pf->flags) == accflags && strcasematch (stem, pf->name))
- return pf->flags & ~(O_RDONLY | O_WRONLY | O_RDWR);
- }
+ if (!*pf->name && ACCFLAGS (pf->flags) == accflags)
+ return pf->flags & ~(O_RDONLY | O_WRONLY | O_RDWR);
+ else
+ {
+ size_t pflen = strlen (pf->name);
+ const char *stem = get_name () + nlen - pflen;
+ if (pflen > nlen || (stem != get_name () && !isdirsep (stem[-1])))
+ continue;
+ else if (ACCFLAGS (pf->flags) == accflags && strcasematch (stem, pf->name))
+ return pf->flags & ~(O_RDONLY | O_WRONLY | O_RDWR);
+ }
}
return __fmode;
}