Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2011-10-22 20:26:30 +0400
committerChristopher Faylor <me@cgf.cx>2011-10-22 20:26:30 +0400
commit6ae28c22639d43de76a9d45362df5055cd38a867 (patch)
tree1d68d36140425f822ed1ad4485051f25b9f71114 /winsup/cygwin/path.h
parentbdea9e5fe8cb19d89015d8a6543ecab4b9e76a01 (diff)
* dtable.cc (dtable::delete_archetype): Improve debugging output.
(dtable::init_std_file_from_handle): Close console handle early, before initialization. Build up openflags for passing to open_setup, just to be safe. (last_tty_dev): New variable. (fh_last_tty_dev): New macro. (fh_alloc): Try again to keep track of previously opened tty, this time by just saving the device and using that to potentially open an archetype. Avoid setting the "/dev/tty" name if the creation of the fhandler failed. (build_fh_pc): Remove unused second argument. Reorganize how and where the name is set. Set last_tty_dev as appropriate. Avoid a NULL dereference in a debug printf. * dtable.h (build_fh_pc): Reflect removal of second parameter. * fhandler.cc (fhandler_base::reset): Use new '<<' operator to copy pc since it preserves any potentially previously set name. (fhandler_base::set_name): Ditto. * fhandler.h (fhandler_*::clone): Throughout use ccalloc to allocate new fhandler, primarily to make sure that pc field is properly zeroed. (fhandler_termios::last): Eliminate. (fhandler_termios): Remove setting of last. (fhandler_base::~fhandler_termios): Ditto. * fhandler_console.cc (fhandler_console::open): Don't make decisions about opening close-on-exec handles here since it makes no sense for archetypes. (fhandler_console::init): Assume that input handle has already been opened. * fhandler_termios.cc (fhandler_termios::last): Delete. * path.h (path_conv::eq_worker): New function. Move bulk of operator = here. (operator <<): New function. (operator =): Use eq_worker to perform old functionality.
Diffstat (limited to 'winsup/cygwin/path.h')
-rw-r--r--winsup/cygwin/path.h32
1 files changed, 30 insertions, 2 deletions
diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h
index 8d5e7c466..9dce9178e 100644
--- a/winsup/cygwin/path.h
+++ b/winsup/cygwin/path.h
@@ -16,6 +16,7 @@ details. */
#include <sys/ioctl.h>
#include <fcntl.h>
+#include <alloca.h>
inline bool
has_attribute (DWORD attributes, DWORD attribs_to_test)
@@ -294,11 +295,12 @@ class path_conv
cfree_and_null (normalized_path);
cfree_and_null (wide_path);
}
- path_conv &operator =(const path_conv& pc)
+ path_conv& eq_worker (const path_conv& pc, const char *in_path,
+ const char *in_normalized_path)
{
free_strings ();
memcpy (this, &pc, sizeof pc);
- path = cstrdup (pc.path);
+ path = cstrdup (in_path);
conv_handle.dup (pc.conv_handle);
normalized_path = cstrdup(pc.normalized_path);
if (pc.wide_path)
@@ -310,6 +312,32 @@ class path_conv
}
return *this;
}
+
+ path_conv &operator << (const path_conv& pc)
+ {
+ const char *save_path;
+ const char *save_normalized_path;
+ if (!path)
+ save_path = pc.path;
+ else
+ {
+ save_path = (char *) alloca (strlen (path) + 1);
+ strcpy ((char *) save_path, path);
+ }
+ if (!normalized_path)
+ save_normalized_path = pc.normalized_path;
+ else
+ {
+ save_normalized_path = (char *) alloca (strlen (normalized_path) + 1);
+ strcpy ((char *) save_normalized_path, path);
+ }
+ return eq_worker (pc, save_path, save_normalized_path);
+ }
+
+ path_conv &operator =(const path_conv& pc)
+ {
+ return eq_worker (pc, pc.path, pc.normalized_path);
+ }
DWORD get_devn () {return (DWORD) dev;}
short get_unitn () const {return dev.get_minor ();}
DWORD file_attributes () const {return fileattr;}