diff --git a/libr/anal/p/anal_8051.c b/libr/anal/p/anal_8051.c index 9f1c5c50d4..7522ff91fb 100644 --- a/libr/anal/p/anal_8051.c +++ b/libr/anal/p/anal_8051.c @@ -84,7 +84,7 @@ static int i8051_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len struct r_anal_plugin_t r_anal_plugin_8051 = { .name = "8051", .arch = R_SYS_ARCH_8051, - .bits = 16, + .bits = 8, .desc = "8051 CPU code analysis plugin", .license = "LGPL3", .init = NULL, diff --git a/libr/asm/p/asm_8051.c b/libr/asm/p/asm_8051.c index 799c6ada8e..83d443e89c 100644 --- a/libr/asm/p/asm_8051.c +++ b/libr/asm/p/asm_8051.c @@ -38,7 +38,7 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) { RAsmPlugin r_asm_plugin_8051 = { .name = "8051", .arch = "8051", - .bits = 16, + .bits = 8, .desc = "8051 Intel CPU", .init = NULL, .fini = NULL, diff --git a/libr/core/config.c b/libr/core/config.c index 81a6206522..e30e8a2c54 100644 --- a/libr/core/config.c +++ b/libr/core/config.c @@ -152,6 +152,7 @@ static int cb_analsplit(void *user, void *data) { } static int cb_asmarch(void *user, void *data) { + char asmparser[32]; RCore *core = (RCore *) user; RConfigNode *node = (RConfigNode *) data; const char *asmos = core->config? r_config_get (core->config, "asm.os"): NULL; @@ -163,11 +164,16 @@ static int cb_asmarch(void *user, void *data) { r_egg_setup (core->egg, node->value, core->anal->bits, 0, R_SYS_OS); if (!r_asm_use (core->assembler, node->value)) eprintf ("asm.arch: cannot find (%s)\n", node->value); - { - char asmparser[32]; - snprintf (asmparser, sizeof (asmparser), "%s.pseudo", node->value); - r_config_set (core->config, "asm.parser", asmparser); + snprintf (asmparser, sizeof (asmparser), "%s.pseudo", node->value); + r_config_set (core->config, "asm.parser", asmparser); + if (!(core->assembler->cur->bits & core->anal->bits)) { + int bits = core->assembler->cur->bits; + if (8&bits) bits = 8; + else if (16&bits) bits=16; + else if (32&bits) bits=32; + else bits=64; + r_config_set_i (core->config, "asm.bits", bits); } if (!r_config_set (core->config, "anal.arch", node->value)) { char *p, *s = strdup (node->value); diff --git a/libr/socket/socket.c b/libr/socket/socket.c index 6830037c37..5ed3e36afc 100644 --- a/libr/socket/socket.c +++ b/libr/socket/socket.c @@ -365,7 +365,7 @@ R_API RSocket *r_socket_accept(RSocket *s) { //signal (SIGPIPE, SIG_DFL); sock->fd = accept (s->fd, (struct sockaddr *)&s->sa, &salen); if (sock->fd == -1) { - r_sys_perror("accept"); + r_sys_perror ("accept"); free (sock); return NULL; }