summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/spawn.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-07-30 08:56:57 +0000
committerCorinna Vinschen <corinna@vinschen.de>2009-07-30 08:56:57 +0000
commit0986989f6a290a15e9229f65dd4846d97ee1864e (patch)
tree041af38e8601244205124efd21317c6f26b4aade /winsup/cygwin/spawn.cc
parent7d3c3d30e7633d9c947c0550b0d4051a7d5947d1 (diff)
downloadcygnal-0986989f6a290a15e9229f65dd4846d97ee1864e.tar.gz
cygnal-0986989f6a290a15e9229f65dd4846d97ee1864e.tar.bz2
cygnal-0986989f6a290a15e9229f65dd4846d97ee1864e.zip
* path.h (class path_conv): Convert path from char array to char *.
Initialize to NULL in constructors. Drop normalized_path_size member. (path_conv::size): Remove. (path_conv::operator =): Always copy with sizeof path_conv. Always duplicate path on cygheap. (path_conv::set_path): Move implementation to spawn.cc. * path.cc (path_conv::set_normalized_path): Always allocate normalized_path on cygheap. (path_conv::check): Don't work on path, rather allocate THIS_path in TLS and use it throughout. When finished, allocate path on cygheap and copy over. Defer tacking on extension after having copied path. * spawn.cc (path_conv::set_path): Implement here.
Diffstat (limited to 'winsup/cygwin/spawn.cc')
-rw-r--r--winsup/cygwin/spawn.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index e292decfd..09b9cd80f 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -87,6 +87,14 @@ perhaps_suffix (const char *prog, path_conv& buf, int& err, unsigned opt)
return ext;
}
+inline void
+path_conv::set_path (const char *p)
+{
+ if (path)
+ cfree (path);
+ path = cstrdup (p);
+}
+
/* Find an executable name, possibly by appending known executable
suffixes to it. The win32-translated name is placed in 'buf'.
Any found suffix is returned in known_suffix.