* cygpath.cc (do_sysfolders): Use cygwin_conv_path.

(do_pathconv): Use cygwin_conv_path and cygwin_conv_path_list.
	* dumper.cc (main): Use cygwin_conv_path.  Allocate target path
	dynamically.
	* mkpasswd.c (current_user): Use cygwin_conv_path.
	(enum_users): Ditto.
	* ps.cc (NT_MAX_PATH): Define.
	(main): Use cygwin_conv_path.
	* regtool.cc (find_key): Ditto. Allocate target path dynamically.
	(cmd_save): Ditto.
This commit is contained in:
Corinna Vinschen
2008-03-12 12:47:09 +00:00
parent edab6053a2
commit 2b2b42cf59
6 changed files with 53 additions and 29 deletions

View File

@@ -20,6 +20,10 @@ details. */
#include <tlhelp32.h>
#include <psapi.h>
/* Maximum possible path length under NT. There's no official define
for that value. Note that PATH_MAX is only 4K. */
#define NT_MAX_PATH 32768
static const char version[] = "$Revision$";
static char *prog_name;
@@ -355,7 +359,9 @@ main (int argc, char *argv[])
else if (p->process_state & PID_TTYOU)
status = 'O';
char pname[PATH_MAX];
/* Maximum possible path length under NT. There's no official define
for that value. */
char pname[NT_MAX_PATH];
if (p->process_state & PID_EXITED || (p->exitcode & ~0xffff))
strcpy (pname, "<defunct>");
else if (p->ppid)
@@ -363,9 +369,11 @@ main (int argc, char *argv[])
char *s;
pname[0] = '\0';
if (p->version >= EXTERNAL_PINFO_VERSION_32_LP)
cygwin_conv_to_posix_path (p->progname_long, pname);
cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE,
p->progname_long, pname, NT_MAX_PATH);
else
cygwin_conv_to_posix_path (p->progname, pname);
cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE,
p->progname, pname, NT_MAX_PATH);
s = strchr (pname, '\0') - 4;
if (s > pname && strcasecmp (s, ".exe") == 0)
*s = '\0';