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:
authorCorinna Vinschen <corinna@vinschen.de>2008-03-11 14:42:00 +0300
committerCorinna Vinschen <corinna@vinschen.de>2008-03-11 14:42:00 +0300
commitbecf251f67689f14e1f9f3ba04b4b2ad586fc77e (patch)
tree268bedae59386c798cab8889834a2dba822d197f /winsup/cygwin/environ.cc
parentff488124ff455b4fe3271282b1585adea74eb84d (diff)
* environ.cc (parse_options): Use tmp_pathbuf to allocate buffer.
(regopt): Take tmp buffer as additional argument. (environ_init): Alllcate tmpbuf earlier. Use as temporary buffer in call to regopt. * tls_pbuf.cc (tmp_pathbuf::c_get): Allocate one additional char. (tmp_pathbuf::w_get): Allocate one additional WCHAR. * winf.cc (av::unshift): Use tmp_pathbuf to allocate buffer.
Diffstat (limited to 'winsup/cygwin/environ.cc')
-rw-r--r--winsup/cygwin/environ.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 3a427bb06..76c6820fb 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -626,7 +626,8 @@ parse_options (char *buf)
if (buf == NULL)
{
- char newbuf[CYG_MAX_PATH + 7];
+ tmp_pathbuf tp;
+ char *newbuf = tp.c_get ();
newbuf[0] = '\0';
for (k = known; k->name != NULL; k++)
if (k->remember)
@@ -705,10 +706,9 @@ parse_options (char *buf)
/* Set options from the registry. */
static bool __stdcall
-regopt (const char *name)
+regopt (const char *name, char *buf)
{
bool parsed_something = false;
- char buf[CYG_MAX_PATH];
char lname[strlen (name) + 1];
strlwr (strcpy (lname, name));
@@ -716,7 +716,7 @@ regopt (const char *name)
{
reg_key r (i, KEY_READ, CYGWIN_INFO_PROGRAM_OPTIONS_NAME, NULL);
- if (r.get_string (lname, buf, sizeof (buf) - 1, "") == ERROR_SUCCESS)
+ if (r.get_string (lname, buf, NT_MAX_PATH, "") == ERROR_SUCCESS)
{
parse_options (buf);
parsed_something = true;
@@ -754,9 +754,11 @@ environ_init (char **envp, int envc)
conv_start_chars[(int) cyg_toupper (conv_envvars[i].name[0])] = 1;
}
- got_something_from_registry = regopt ("default");
+ char *tmpbuf = tp.t_get ();
+ got_something_from_registry = regopt ("default", tmpbuf);
if (myself->progname[0])
- got_something_from_registry = regopt (myself->progname) || got_something_from_registry;
+ got_something_from_registry = regopt (myself->progname, tmpbuf)
+ || got_something_from_registry;
if (!envp)
envp_passed_in = 0;
@@ -807,7 +809,6 @@ environ_init (char **envp, int envc)
form "=X:=X:\foo\bar; these must be changed into something legal
(we could just ignore them but maybe an application will
eventually want to use them). */
- char *tmpbuf = tp.t_get ();
for (i = 0, w = rawenv; *w != L'\0'; w = wcschr (w, L'\0') + 1, i++)
{
sys_wcstombs_alloc (&newp, HEAP_NOTHEAP, w);