diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-17 18:39:36 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-17 18:39:36 +0000 |
| commit | 3b3ca113ed00a6781a28172bb3a6860a5f79ea02 (patch) | |
| tree | 7834909b21af2b0fdbb7c3c52dc3fef12ba0c051 /libbb/procps.c | |
| parent | 18875bf772d72c9c543be8f9ab46dec451f547ea (diff) | |
| download | busybox-w32-3b3ca113ed00a6781a28172bb3a6860a5f79ea02.tar.gz busybox-w32-3b3ca113ed00a6781a28172bb3a6860a5f79ea02.tar.bz2 busybox-w32-3b3ca113ed00a6781a28172bb3a6860a5f79ea02.zip | |
pidof/killall: allow find_pid_by_name to find running
processes started as scripts_with_name_longer_than_15_bytes.sh
closes bug 4054 (and is generally neat)
Diffstat (limited to 'libbb/procps.c')
| -rw-r--r-- | libbb/procps.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/libbb/procps.c b/libbb/procps.c index a5168a077..f799099fd 100644 --- a/libbb/procps.c +++ b/libbb/procps.c | |||
| @@ -78,7 +78,7 @@ const char* FAST_FUNC get_cached_groupname(gid_t gid) | |||
| 78 | 78 | ||
| 79 | #define PROCPS_BUFSIZE 1024 | 79 | #define PROCPS_BUFSIZE 1024 |
| 80 | 80 | ||
| 81 | static int FAST_FUNC read_to_buf(const char *filename, void *buf) | 81 | static int read_to_buf(const char *filename, void *buf) |
| 82 | { | 82 | { |
| 83 | int fd; | 83 | int fd; |
| 84 | /* open_read_close() would do two reads, checking for EOF. | 84 | /* open_read_close() would do two reads, checking for EOF. |
| @@ -385,16 +385,15 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) | |||
| 385 | n = read_to_buf(filename, buf); | 385 | n = read_to_buf(filename, buf); |
| 386 | if (n <= 0) | 386 | if (n <= 0) |
| 387 | break; | 387 | break; |
| 388 | #if ENABLE_PGREP || ENABLE_PKILL | ||
| 389 | if (flags & PSSCAN_ARGVN) { | 388 | if (flags & PSSCAN_ARGVN) { |
| 390 | do { | 389 | sp->argv_len = n; |
| 391 | n--; | 390 | sp->argv0 = xmalloc(n + 1); |
| 392 | if (buf[n] == '\0') | 391 | memcpy(sp->argv0, buf, n + 1); |
| 393 | buf[n] = ' '; | 392 | /* sp->argv0[n] = '\0'; - buf has it */ |
| 394 | } while (n); | 393 | } else { |
| 394 | sp->argv_len = 0; | ||
| 395 | sp->argv0 = xstrdup(buf); | ||
| 395 | } | 396 | } |
| 396 | #endif | ||
| 397 | sp->argv0 = xstrdup(buf); | ||
| 398 | } | 397 | } |
| 399 | #endif | 398 | #endif |
| 400 | break; | 399 | break; |
