aboutsummaryrefslogtreecommitdiff
path: root/lib/lib.c
diff options
context:
space:
mode:
authorElie De Brauwer <eliedebrauwer@gmail.com>2012-12-16 13:43:36 +0100
committerElie De Brauwer <eliedebrauwer@gmail.com>2012-12-16 13:43:36 +0100
commitca4035bdacfd83f815323c9c597f2683fc4aa218 (patch)
treeb1bc7cdeb58ce9a18efc22cce9fbbe1d186a9f98 /lib/lib.c
parenta48e5792bb26f95c18055f58d602ac279ebd4002 (diff)
downloadtoybox-ca4035bdacfd83f815323c9c597f2683fc4aa218.tar.gz
Extend killall with support for -v and -i
Diffstat (limited to 'lib/lib.c')
-rw-r--r--lib/lib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 148a7652..5b591d44 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -158,7 +158,7 @@ void xprintf(char *format, ...)
void xputs(char *s)
{
- if (EOF == puts(s)) perror_exit("write");
+ if (EOF == puts(s) || fflush(stdout)) perror_exit("write");
}
void xputc(char c)
@@ -975,7 +975,7 @@ int yesno(char *prompt, int def)
}
// Execute a callback for each PID that matches a process name from a list.
-void for_each_pid_with_name_in(char **names, int (*callback)(pid_t pid))
+void for_each_pid_with_name_in(char **names, int (*callback)(pid_t pid, char *name))
{
DIR *dp;
struct dirent *entry;
@@ -999,7 +999,7 @@ void for_each_pid_with_name_in(char **names, int (*callback)(pid_t pid))
for (curname = names; *curname; curname++)
if (!strcmp(basename(cmd), *curname))
- if (!callback(atol(entry->d_name))) goto done;
+ if (!callback(atol(entry->d_name), *curname)) goto done;
}
done:
closedir(dp);