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-06 21:26:18 +0300
committerCorinna Vinschen <corinna@vinschen.de>2007-12-06 21:26:18 +0300
commit9408cf38dd974de7fc12ecd95c42617f440aec3f (patch)
tree4fd698989ac36601edbc06d0685b24fc3a191d83 /winsup/utils/ps.cc
parent36093cfbbfaaa714ef049265d91bbde67d889e2c (diff)
* ps.cc: Include limits.h.
(main): Set file name buffer size to PATH_MAX. Use progname or progname_long member of struct external_pinfo dependent of the value of the struct's version member.
Diffstat (limited to 'winsup/utils/ps.cc')
-rw-r--r--winsup/utils/ps.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/winsup/utils/ps.cc b/winsup/utils/ps.cc
index 651175144..2a0ef01c8 100644
--- a/winsup/utils/ps.cc
+++ b/winsup/utils/ps.cc
@@ -15,6 +15,7 @@ details. */
#include <unistd.h>
#include <stdlib.h>
#include <pwd.h>
+#include <limits.h>
#include <sys/cygwin.h>
#include <tlhelp32.h>
#include <psapi.h>
@@ -354,14 +355,17 @@ main (int argc, char *argv[])
else if (p->process_state & PID_TTYOU)
status = 'O';
- char pname[MAX_PATH];
+ char pname[PATH_MAX];
if (p->process_state & PID_EXITED || (p->exitcode & ~0xffff))
strcpy (pname, "<defunct>");
else if (p->ppid)
{
char *s;
pname[0] = '\0';
- cygwin_conv_to_posix_path (p->progname, pname);
+ if (p->version >= EXTERNAL_PINFO_VERSION_32_LP)
+ cygwin_conv_to_posix_path (p->progname_long, pname);
+ else
+ cygwin_conv_to_posix_path (p->progname, pname);
s = strchr (pname, '\0') - 4;
if (s > pname && strcasecmp (s, ".exe") == 0)
*s = '\0';
@@ -376,7 +380,7 @@ main (int argc, char *argv[])
DWORD n = p->dwProcessId;
if (!myEnumProcessModules (h, hm, sizeof (hm), &n))
n = 0;
- if (!n || !myGetModuleFileNameEx (h, hm[0], pname, MAX_PATH))
+ if (!n || !myGetModuleFileNameEx (h, hm[0], pname, PATH_MAX))
strcpy (pname, "*** unknown ***");
FILETIME ct, et, kt, ut;
if (GetProcessTimes (h, &ct, &et, &kt, &ut))