Fix #10500 - oo reopens without debugger

This commit is contained in:
pancake 2018-06-27 00:24:31 +02:00
parent 2745486b16
commit 15ff90059f
2 changed files with 16 additions and 2 deletions

View File

@ -28,7 +28,7 @@ R_API int r_bin_open(RBin *bin, const char *filename, RBinOptions *bo) {
rawstr = bo->rawstr;
}
if (r_bin_load (bin, filename, baddr, laddr, xtr_idx, iofd, rawstr)) {
int id = bin->cur->id;
int id = bin->cur->id; // TODO rename to bd?
r_id_storage_set (bin->ids, bin->cur, id);
return id;
}

View File

@ -1440,7 +1440,21 @@ static int cmd_open(void *data, const char *input) {
} else {
fd = core->io->desc->fd;
}
r_io_reopen (core->io, fd, R_IO_READ, 644);
if (r_config_get_i (core->config, "cfg.debug")) {
RBinFile *bf = r_core_bin_cur (core);
if (bf && r_file_exists (bf->file)) {
char *file = strdup (bf->file);
r_core_cmd0 (core, "ob-*");
r_io_close_all (core->io);
r_config_set (core->config, "cfg.debug", "false");
r_core_cmdf (core, "o %s", file);
free (file);
} else {
eprintf ("Nothing to do.\n");
}
} else {
r_io_reopen (core->io, fd, R_IO_READ, 644);
}
}
break;
case '?':