No ldconfig if /usr installs and fix segfault using RCore api

This commit is contained in:
pancake 2013-06-17 11:41:00 +02:00
parent 9adaefef8e
commit 7e5f1f5851
4 changed files with 12 additions and 5 deletions

View File

@ -163,7 +163,7 @@ static int r_bin_init_items(RBin *bin, int dummy) {
if (!cp || !cp->load || !cp->load (a)) {
r_buf_free (a->buf);
a->buf = r_buf_mmap (bin->cur.file, 0);
a->size = a->buf->length;
a->size = a->buf? a->buf->length: 0;
o->strings = get_strings (a, minlen);
return R_FALSE;
}

View File

@ -143,7 +143,7 @@ R_API int r_core_bin_load(RCore *r, const char *file) {
ut64 offset;
RIOMap *im;
if (file == NULL)
if (file == NULL || !*file)
if (r->file)
file = r->file->filename;
if (!file) {

View File

@ -14,13 +14,15 @@ core = RCore()
# Detect sub-bins in fatmach0
path="/tmp/fatmach0-3true"
path="/bin/ls"
core.bin.load (path, 0)
print ("Supported archs: %d"%core.bin.narch)
for i in range (0,core.bin.narch):
core.bin.select_idx (i)
info = core.bin.get_info ()
print ("%d: %s %s"%(i,info.arch,info.bits))
if info:
print ("%d: %s %s"%(i,info.arch,info.bits))
# Load file in core
core.config.set ("asm.arch", "x86");
@ -28,6 +30,7 @@ core.config.set ("asm.bits", "32");
#core.config.set ("asm.bits", "64");
f = core.file_open(path, False, 0)
#core.bin_load (None)
core.bin_load ("")
# show entrypoint

View File

@ -3,8 +3,12 @@ LD=/etc/ld.so.conf.d
if test -w $LD ; then
if type ldconfig > /dev/null 2>&1 ; then
mkdir -p $LD
awk -F= '/^LIBDIR/{print $2}' config-user.mk > $LD/radare.conf
ldconfig
P=$(awk -F= '/^LIBDIR/{print $2}' config-user.mk)
D=`dirname $P``basename $P`
if [ /usr != "$D" ]; then
echo $P > $LD/radare.conf
ldconfig
fi
fi
fi
exit 0