diff options
Diffstat (limited to '')
-rw-r--r-- | libbb/find_pid_by_name.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libbb/find_pid_by_name.c b/libbb/find_pid_by_name.c index fe13f7211..0b6d5a206 100644 --- a/libbb/find_pid_by_name.c +++ b/libbb/find_pid_by_name.c | |||
@@ -39,8 +39,10 @@ and therefore comm field contains "exe". | |||
39 | 39 | ||
40 | static int comm_match(procps_status_t *p, const char *procName) | 40 | static int comm_match(procps_status_t *p, const char *procName) |
41 | { | 41 | { |
42 | #if !ENABLE_PLATFORM_MINGW32 | ||
42 | int argv1idx; | 43 | int argv1idx; |
43 | const char *argv1; | 44 | const char *argv1; |
45 | #endif | ||
44 | 46 | ||
45 | if (strncmp(p->comm, procName, 15) != 0) | 47 | if (strncmp(p->comm, procName, 15) != 0) |
46 | return 0; /* comm does not match */ | 48 | return 0; /* comm does not match */ |
@@ -55,6 +57,7 @@ static int comm_match(procps_status_t *p, const char *procName) | |||
55 | * This can be crazily_long_script_name.sh! | 57 | * This can be crazily_long_script_name.sh! |
56 | * The telltale sign is basename(argv[1]) == procName */ | 58 | * The telltale sign is basename(argv[1]) == procName */ |
57 | 59 | ||
60 | #if !ENABLE_PLATFORM_MINGW32 | ||
58 | if (!p->argv0) | 61 | if (!p->argv0) |
59 | return 0; | 62 | return 0; |
60 | 63 | ||
@@ -65,6 +68,7 @@ static int comm_match(procps_status_t *p, const char *procName) | |||
65 | 68 | ||
66 | if (strcmp(bb_basename(argv1), procName) != 0) | 69 | if (strcmp(bb_basename(argv1), procName) != 0) |
67 | return 0; | 70 | return 0; |
71 | #endif | ||
68 | 72 | ||
69 | return 1; | 73 | return 1; |
70 | } | 74 | } |
@@ -87,6 +91,7 @@ pid_t* FAST_FUNC find_pid_by_name(const char *procName) | |||
87 | pidList = xzalloc(sizeof(*pidList)); | 91 | pidList = xzalloc(sizeof(*pidList)); |
88 | while ((p = procps_scan(p, PSSCAN_PID|PSSCAN_COMM|PSSCAN_ARGVN|PSSCAN_EXE))) { | 92 | while ((p = procps_scan(p, PSSCAN_PID|PSSCAN_COMM|PSSCAN_ARGVN|PSSCAN_EXE))) { |
89 | if (comm_match(p, procName) | 93 | if (comm_match(p, procName) |
94 | #if !ENABLE_PLATFORM_MINGW32 | ||
90 | /* or we require argv0 to match (essential for matching reexeced /proc/self/exe)*/ | 95 | /* or we require argv0 to match (essential for matching reexeced /proc/self/exe)*/ |
91 | || (p->argv0 && strcmp(bb_basename(p->argv0), procName) == 0) | 96 | || (p->argv0 && strcmp(bb_basename(p->argv0), procName) == 0) |
92 | /* or we require /proc/PID/exe link to match */ | 97 | /* or we require /proc/PID/exe link to match */ |
@@ -95,6 +100,7 @@ pid_t* FAST_FUNC find_pid_by_name(const char *procName) | |||
95 | : bb_basename(p->exe), | 100 | : bb_basename(p->exe), |
96 | procName | 101 | procName |
97 | ) == 0) | 102 | ) == 0) |
103 | #endif | ||
98 | ) { | 104 | ) { |
99 | pidList = xrealloc_vector(pidList, 2, i); | 105 | pidList = xrealloc_vector(pidList, 2, i); |
100 | pidList[i++] = p->pid; | 106 | pidList[i++] = p->pid; |