Use r_sandbox_kill instead of kill

This commit is contained in:
pancake 2013-03-02 19:44:10 +01:00
parent 13bbde408a
commit 701a43fc23
5 changed files with 10 additions and 14 deletions

View File

@ -4,7 +4,6 @@
|__\__|_|__|___/__|__|_\__\___\ |____(_)____/
Broken stuff to fixe before release
===================================
- java
@ -14,6 +13,7 @@ Broken stuff to fixe before release
0.9.4
=====
* continue execution until condition happen (reg, mem, ..)
* rabin2 -x should not work on non-fatmach0 files
* foldable stuff .. was in r1..redo?
* cmp rip+xx -> not resolved wtf

View File

@ -342,7 +342,7 @@ R_API int r_debug_continue_kill(RDebug *dbg, int sig) {
#if __UNIX__
/* XXX Uh? */
if (dbg->stop_all_threads && dbg->pid>0)
kill (dbg->pid, SIGSTOP);
r_sandbox_kill (dbg->pid, SIGSTOP);
#endif
#endif
r_debug_select (dbg, dbg->pid, ret);

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2012 pancake */
/* radare - LGPL - Copyright 2009-2013 pancake */
#include <r_userconf.h>
#include <r_debug.h>
@ -1114,15 +1114,6 @@ if (dbg->bits & R_SYS_BITS_32) {
#endif
}
/*
TODO: list all pids in linux and bsd.. osx seems to be strange
int i;
for (i=1; i<9999; i++) {
if (!kill (i, 0))
r_list_append (list, r_debug_pid_new ("???", i, 's', 0));
}
*/
#if __APPLE__
// XXX
static RDebugPid *darwin_get_pid(int pid) {
@ -1303,7 +1294,7 @@ static RList *r_debug_native_pids(int pid) {
closedir (dh);
} else
for (i=2; i<MAXPID; i++) {
if (!kill (i, 0)) {
if (!r_sandbox_kill (i, 0)) {
// TODO: Use slurp!
snprintf (cmdline, sizeof (cmdline), "/proc/%d/cmdline", i);
fd = open (cmdline, O_RDONLY);
@ -2120,7 +2111,7 @@ static int r_debug_native_kill(RDebug *dbg, int pid, int tid, int sig) {
} else {
#endif
if (pid==0) pid = dbg->pid;
if ((kill (pid, sig) != -1))
if ((r_sandbox_kill (pid, sig) != -1))
ret = R_TRUE;
if (errno == 1) // EPERM
ret = -R_TRUE;

View File

@ -534,6 +534,7 @@ R_API int r_sandbox_open (const char *path, int mode, int perm);
R_API FILE *r_sandbox_fopen (const char *path, const char *mode);
R_API int r_sandbox_chdir (const char *path);
R_API int r_sandbox_check_path (const char *path);
R_API int r_sandbox_kill(int pid, int sig);
/* strpool */
#define R_STRPOOL_INC 1024

View File

@ -83,6 +83,10 @@ R_API int r_sandbox_kill(int pid, int sig) {
if (enabled) // XXX: fine-tune. maybe we want to enable kill for child?
return -1;
#if __UNIX__
if (pid<1) {
eprintf ("r_sandbox_kill: Better not to kill negative pids.\n");
return -1;
}
return kill (pid, sig);
#else
return -1;