Skip to content

Commit

Permalink
Hide the rasm2/rabin2/.. unrelated plugin loading errors ##shell
Browse files Browse the repository at this point in the history
* Use the debug log level instead
  • Loading branch information
radare authored and trufae committed Oct 29, 2023
1 parent cc3d1f5 commit 386d948
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions libr/main/rasm2.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ static int __lib_anal_cb(RLibPlugin *pl, void *user, void *data) {
}

/* arch callback */
// TODO: this should be bool
static int __lib_arch_cb(RLibPlugin *pl, void *user, void *data) {
RArchPlugin *hand = (RArchPlugin *)data;
RAsmState *as = (RAsmState *)user;
Expand Down
16 changes: 10 additions & 6 deletions libr/util/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,15 @@ static bool __lib_dl_check_filename(const char *file) {

R_API int r_lib_run_handler(RLib *lib, RLibPlugin *plugin, RLibStruct *symbol) {
RLibHandler *h = plugin->handler;
if (h && h->constructor) {
R_LOG_DEBUG ("PLUGIN LOADED %p fcn %p", h, h->constructor);
return h->constructor (plugin, h->user, symbol->data);
if (h) {
if (h->constructor) {
R_LOG_DEBUG ("PLUGIN LOADED %p fcn %p", h, h->constructor);
return h->constructor (plugin, h->user, symbol->data);
}
R_LOG_DEBUG ("Cannot find plugin constructor");
return -1;
}
R_LOG_DEBUG ("Cannot find plugin constructor");
return -1;
return 0;
}

R_API RLibHandler *r_lib_get_handler(RLib *lib, int type) {
Expand Down Expand Up @@ -363,9 +366,10 @@ R_API int r_lib_open_ptr(RLib *lib, const char *file, void *handler, RLibStruct
p->handler = r_lib_get_handler (lib, p->type);
p->free = stru->free;

// TODO: this should be bool
int ret = r_lib_run_handler (lib, p, stru);
if (ret == -1) {
R_LOG_ERROR ("Library handler has failed for '%s'", file);
R_LOG_DEBUG ("Library handler has failed for '%s'", file);
free (p->file);
free (p);
r_lib_dl_close (handler);
Expand Down

0 comments on commit 386d948

Please sign in to comment.