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>2010-05-18 18:30:51 +0400
committerChristopher Faylor <me@cgf.cx>2010-05-18 18:30:51 +0400
commitd3258e063cb0a4fc77a76df3c91ba9841ca4971c (patch)
tree2921ded7329f12667d439c207fa81f15575dba14 /winsup/cygwin/fhandler_process.cc
parentc8bd391c328c8650a93388f5cb3409c3740ee963 (diff)
* environ.cc (regopt): Change the first argument to wide char string.
(environ_init): Accommodate change to the first argument of regopt. * exception.cc (open_stackdumpfile): Accommodate change to the type of progname in _pinfo. * external.cc (fillout_pinfo): Ditto. * fhandler_process.cc (format_process_winexename): Ditto. (format_process_stat): Ditto. * fork.cc (fork::parent): Ditto. * pinfo.cc (pinfo_basic::pinfo_basic): Call GetModuleFileNameW instead of GetModuleFileName. (pinfo::thisproc): Accommodate change to the type of progname in _pinfo. (pinfo_init): Ditto. * pinfo.h (_pinfo): Change the type of progname to a wide char array. * registry.h (reg_key::get_int): Change the first argument from constant point to pointer to constant. (reg_key::get_string): Ditto. Change the last argument likewise. * registry.cc (reg_key::get_int): Accommodate change to the declaration. (reg_key::get_string): Ditto. * strace.cc (strace::hello): Accommodate change to the type of progname in _pinfo. (strace::vsprntf): Ditto.
Diffstat (limited to 'winsup/cygwin/fhandler_process.cc')
-rw-r--r--winsup/cygwin/fhandler_process.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc
index 10610541f..83b69b84a 100644
--- a/winsup/cygwin/fhandler_process.cc
+++ b/winsup/cygwin/fhandler_process.cc
@@ -537,9 +537,9 @@ static _off64_t
format_process_winexename (void *data, char *&destbuf)
{
_pinfo *p = (_pinfo *) data;
- int len = strlen (p->progname);
- destbuf = (char *) crealloc_abort (destbuf, len + 2);
- strcpy (destbuf, p->progname);
+ size_t len = sys_wcstombs (NULL, 0, p->progname);
+ destbuf = (char *) crealloc_abort (destbuf, len + 1);
+ sys_wcstombs (destbuf, len, p->progname);
destbuf[len] = '\n';
return len + 1;
}
@@ -649,6 +649,7 @@ format_process_stat (void *data, char *&destbuf)
{
_pinfo *p = (_pinfo *) data;
char cmd[NAME_MAX + 1];
+ WCHAR wcmd[NAME_MAX + 1];
int state = 'R';
unsigned long fault_count = 0UL,
utime = 0UL, stime = 0UL,
@@ -659,8 +660,9 @@ format_process_stat (void *data, char *&destbuf)
strcpy (cmd, "<defunct>");
else
{
- char *last_slash = strrchr (p->progname, '\\');
- strcpy (cmd, last_slash ? last_slash + 1 : p->progname);
+ PWCHAR last_slash = wcsrchr (p->progname, L'\\');
+ wcscpy (wcmd, last_slash ? last_slash + 1 : p->progname);
+ sys_wcstombs (cmd, NAME_MAX + 1, wcmd);
int len = strlen (cmd);
if (len > 4)
{
@@ -779,6 +781,7 @@ format_process_status (void *data, char *&destbuf)
{
_pinfo *p = (_pinfo *) data;
char cmd[NAME_MAX + 1];
+ WCHAR wcmd[NAME_MAX + 1];
int state = 'R';
const char *state_str = "unknown";
unsigned long vmsize = 0UL, vmrss = 0UL, vmdata = 0UL, vmlib = 0UL, vmtext = 0UL,
@@ -787,8 +790,9 @@ format_process_status (void *data, char *&destbuf)
strcpy (cmd, "<defunct>");
else
{
- char *last_slash = strrchr (p->progname, '\\');
- strcpy (cmd, last_slash ? last_slash + 1 : p->progname);
+ PWCHAR last_slash = wcsrchr (p->progname, L'\\');
+ wcscpy (wcmd, last_slash ? last_slash + 1 : p->progname);
+ sys_wcstombs (cmd, NAME_MAX + 1, wcmd);
int len = strlen (cmd);
if (len > 4)
{