diff options
author | Christopher Faylor <me@cgf.cx> | 2009-08-04 04:20:36 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2009-08-04 04:20:36 +0000 |
commit | 824d851859450e8c3943d0439fc57a3520081eb4 (patch) | |
tree | f6ac160a57aee5c0875ba90309fba2ce6337158c /winsup/cygwin/pipe.cc | |
parent | ff7b364c121175ad1b5b88ec4010ee81dab1e5c4 (diff) | |
download | cygnal-824d851859450e8c3943d0439fc57a3520081eb4.tar.gz cygnal-824d851859450e8c3943d0439fc57a3520081eb4.tar.bz2 cygnal-824d851859450e8c3943d0439fc57a3520081eb4.zip |
* fhandler.h (fhandler_cygdrive:DRVSZ): New enum.
(pdrive_buf): New place to hold information about cygdrive.
* fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Store drive info in
pdrive_buf since get_win32_name() could now be too small to hold everything.
(fhandler_cygdrive::rewinddir): Reset pdrive to pdrive_buf.
(fhandler_cygdrive::closedir): Ditto.
* pipe.cc (fhandler_pipe::init): Be more defensive when referencing
get_win32_name(). Rework logic which made a copy of the POSIX path and then
never used it.
Diffstat (limited to 'winsup/cygwin/pipe.cc')
-rw-r--r-- | winsup/cygwin/pipe.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc index e8c7070b1..a694bceef 100644 --- a/winsup/cygwin/pipe.cc +++ b/winsup/cygwin/pipe.cc @@ -32,13 +32,15 @@ fhandler_pipe::fhandler_pipe () int fhandler_pipe::init (HANDLE f, DWORD a, mode_t mode) { - // FIXME: Have to clean this up someday - if (!*get_win32_name () && get_name ()) + /* FIXME: Have to clean this up someday + FIXME: Do we have to check for both !get_win32_name() and + !*get_win32_name()? */ + if ((!get_win32_name () || !*get_win32_name ()) && get_name ()) { + char *d; + const char *s; char *hold_normalized_name = (char *) alloca (strlen (get_name ()) + 1); - strcpy (hold_normalized_name, get_name ()); - char *s, *d; - for (s = hold_normalized_name, d = (char *) get_win32_name (); *s; s++, d++) + for (s = get_name (), d = hold_normalized_name; *s; s++, d++) if (*s == '/') *d = '\\'; else |