bash: fix segfault with kill_by_name() on x86_64.

* missing libgen.h include would default return value of basename()
to int instead of char*.
This commit is contained in:
Jerome Duval
2016-04-30 18:09:46 +00:00
parent d15e3fb71b
commit 88f0e6c543
2 changed files with 14 additions and 16 deletions

View File

@@ -6,26 +6,27 @@ Subject: [PATCH] Patch bash's builtin kill...
... to handle the kill by name functionality. Fixes #9687 and
reintroduces the ability to kill jobs.
---
builtins/kill.def | 73 ++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 59 insertions(+), 14 deletions(-)
diff --git a/builtins/kill.def b/builtins/kill.def
index 2e68f03..994b179 100644
index 2e68f03..7fa3191 100644
--- a/builtins/kill.def
+++ b/builtins/kill.def
@@ -54,6 +54,8 @@ $END
@@ -54,9 +54,12 @@ $END
# include <unistd.h>
#endif
+#include <OS.h>
+
#include "../bashansi.h"
#include "../bashintl.h"
@@ -79,6 +81,42 @@ static void kill_error __P((pid_t, int));
+#include <libgen.h>
#include <signal.h>
#include "../shell.h"
@@ -79,6 +82,42 @@ static void kill_error __P((pid_t, int));
# define CONTINUE_OR_FAIL goto continue_killing
#endif /* CONTINUE_AFTER_KILL_ERROR */
+int kill_by_name(int signum, const char *name)
+{
+ team_info teamInfo;
@@ -65,9 +66,9 @@ index 2e68f03..994b179 100644
/* Here is the kill builtin. We only have it so that people can type
kill -KILL %1? No, if you fill up the process table this way you
can still kill some. */
@@ -179,20 +217,27 @@ kill_builtin (list)
@@ -179,20 +218,27 @@ kill_builtin (list)
word++;
/* Use the entire argument in case of minus sign presence. */
- if (*word && legal_number (list->word->word, &pid_value) && (pid_value == (pid_t)pid_value))
- {
@@ -107,6 +108,3 @@ index 2e68f03..994b179 100644
}
#if defined (JOB_CONTROL)
else if (*list->word->word && *list->word->word != '%')
--
1.8.3.4