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>2007-12-12 15:12:24 +0300
committerCorinna Vinschen <corinna@vinschen.de>2007-12-12 15:12:24 +0300
commit1feea0bfd74d260dcd52618edec238808ada47ac (patch)
tree557b28e8036ca44a53ffd481e14d8033a64a9f6d /winsup/cygwin/environ.cc
parent5c80ea02302e031225003689df63eb206d248a35 (diff)
* dcrt0.cc: Include string.h.
(initial_env): Use small_printf's %P specifier. * dll_init.cc (dll_list::alloc): Use PATH_MAX instead of CYG_MAX_PATH for path name buffer size. * dll_init.h (struct dll): Ditto. * environ.cc: Include string.h. (win_env::add_cache): Use temporary local buffer for path conversion. (posify): Ditto. * exceptions.cc (try_to_debug): Use CreateProcessW to allow long path names. * miscfuncs.cc: Drop unused implementations of strcasematch and strncasematch. (ch_case_eq): Drop. (strcasestr): Drop. (cygwin_wcscasecmp): New function. (cygwin_wcsncasecmp): New function. (cygwin_strcasecmp): New function. (cygwin_strncasecmp): New function. (cygwin_wcslwr): New function. (cygwin_wcsupr): New function. (cygwin_strlwr): New function. (cygwin_strupr): New function. * ntdll.h (RtlDowncaseUnicodeString): Declare. (RtlUpcaseUnicodeString): Declare. (RtlInt64ToHexUnicodeString): Fix typo in comment. * string.h: Disable not NLS aware implementations of strcasematch and strncasematch. (cygwin_strcasecmp): Declare. (strcasecmp): Define as cygwin_strcasecmp. (cygwin_strncasecmp): Declare. (strncasecmp): Define as cygwin_strncasecmp. (strcasematch):Define using cygwin_strcasecmp. (strncasematch):Define using cygwin_strncasecmp. (cygwin_strlwr): Declare. (strlwr): Define as cygwin_strlwr. (cygwin_strupr): Declare. (strupr): Define as cygwin_strupr. * wchar.h: New file. * wincap.cc (wincapc::init): Use "NT" as fix OS string. * winsup.h (strcasematch): Drop declaration. (strncasematch): Ditto. (strcasestr): Ditto.
Diffstat (limited to 'winsup/cygwin/environ.cc')
-rw-r--r--winsup/cygwin/environ.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index e91cc5ad2..9c68dcaaf 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -11,6 +11,7 @@ details. */
#include "winsup.h"
#include <stdlib.h>
#include <stddef.h>
+#include <string.h>
#include <ctype.h>
#include <assert.h>
#include <sys/cygwin.h>
@@ -114,9 +115,12 @@ win_env::add_cache (const char *in_posix, const char *in_native)
}
else
{
- native = (char *) realloc (native, namelen + 1 + win32_len (in_posix));
+ char buf[PATH_MAX];
+ strcpy (buf, name + namelen);
+ towin32 (in_posix, buf);
+ native = (char *) realloc (native, namelen + 1 + strlen (buf));
strcpy (native, name);
- towin32 (in_posix, native + namelen);
+ strcpy (native + namelen, buf);
}
MALLOC_CHECK;
if (immediate && cygwin_finished_initializing)
@@ -180,7 +184,7 @@ posify (char **here, const char *value)
/* Turn all the items from c:<foo>;<bar> into their
mounted equivalents - if there is one. */
- char *outenv = (char *) malloc (1 + len + conv->posix_len (value));
+ char outenv[1 + len + PATH_MAX];
memcpy (outenv, src, len);
char *newvalue = outenv + len;
if (!conv->toposix (value, newvalue) || _impure_ptr->_errno != EIDRM)
@@ -195,7 +199,7 @@ posify (char **here, const char *value)
}
debug_printf ("env var converted to %s", outenv);
- *here = outenv;
+ *here = strdup (outenv);
free (src);
MALLOC_CHECK;
}