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)
This commit is contained in:
Denis Vlasenko
2008-07-17 18:39:36 +00:00
parent 18875bf772
commit 3b3ca113ed
5 changed files with 53 additions and 23 deletions

View File

@@ -22,7 +22,6 @@ int pidof_main(int argc UNUSED_PARAM, char **argv)
unsigned first = 1;
unsigned opt;
#if ENABLE_FEATURE_PIDOF_OMIT
char ppid_str[sizeof(int)*3 + 1];
llist_t *omits = NULL; /* list of pids to omit */
opt_complementary = "o::";
#endif
@@ -39,8 +38,7 @@ int pidof_main(int argc UNUSED_PARAM, char **argv)
while (omits_p) {
/* are we asked to exclude the parent's process ID? */
if (strcmp(omits_p->data, "%PPID") == 0) {
sprintf(ppid_str, "%u", (unsigned)getppid());
omits_p->data = ppid_str;
omits_p->data = utoa((unsigned)getppid());
}
omits_p = omits_p->link;
}