Fix last covs

This commit is contained in:
Sergi Àlvarez i Capilla 2022-01-28 15:23:44 +01:00
parent 060058b2e2
commit 4474cbab01
9 changed files with 18 additions and 12 deletions

View File

@ -987,10 +987,12 @@ R_API bool r2r_check_jq_available(void) {
const char *args[] = {"."};
const char *invalid_json = "this is not json lol";
R2RSubprocess *proc = r2r_subprocess_start (JQ_CMD, args, 1, NULL, NULL, 0);
if (proc) {
r2r_subprocess_stdin_write (proc, (const ut8 *)invalid_json, strlen (invalid_json));
r2r_subprocess_wait (proc, UT64_MAX);
if (!proc) {
eprintf ("Cnnot start subprocess\n");
return false;
}
r2r_subprocess_stdin_write (proc, (const ut8 *)invalid_json, strlen (invalid_json));
r2r_subprocess_wait (proc, UT64_MAX);
r_th_lock_enter (proc->lock);
bool invalid_detected = proc && proc->ret != 0;
r_th_lock_leave (proc->lock);

View File

@ -1322,7 +1322,7 @@ rep:
if (fi) {
if (*color) {
ret = r_flag_item_set_color (fi, color);
if (!color && ret) {
if (ret) {
r_cons_println (ret);
}
} else {

View File

@ -1872,7 +1872,6 @@ static void annotated_hexdump(RCore *core, const char *str, int len) {
chars[0] = '\0';
ebytes = bytes;
echars = chars;
// hascolor = false;
ut64 ea = addr;
if (core->print->pava) {
ut64 va = r_io_p2v (core->io, addr);

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2019 - pancake */
/* radare - LGPL - Copyright 2019-2022 - pancake */
#include <r_core.h>
@ -159,11 +159,12 @@ R_API int r_core_visual_view_zigns(RCore *core) {
char cmd[1024];
r_cons_show_cursor (true);
r_cons_set_raw (0);
cmd[0]='\0';
cmd[0] = '\0';
r_line_set_prompt (":> ");
if (r_cons_fgets (cmd, sizeof (cmd), 0, NULL) < 0) {
cmd[0] = '\0';
}
cmd[sizeof (cmd) - 1] = 0;
r_core_cmd_task_sync (core, cmd, 1);
r_cons_set_raw (1);
r_cons_show_cursor (false);

View File

@ -74,7 +74,7 @@ R_API int r_main_ravc2(int argc, const char **argv) {
eprintf ("TODO: r_vc_git APIs should be called from r_vc\n");
eprintf ("TODO: r_vc_new should accept options argument\n");
}
const char *action = (argc >= 2)? opt.argv[opt.ind] : NULL;
const char *action = opt.argv[opt.ind];
if (!action) {
return 1;
}

View File

@ -2649,6 +2649,9 @@ static void decl_initializer(TCCState *s1, CType *type, unsigned long c, int fir
}
s = type->ref;
f = s->next;
if (!f) {
TCC_ERR ("missing next entry");
}
array_length = 0;
index = 0;
n = s->c;

View File

@ -611,7 +611,7 @@ R_API char* r_print_hexpair(RPrint *p, const char *str, int n) {
static char colorbuffer[64];
#define P(x) (p->cons && p->cons->context->pal.x)? p->cons->context->pal.x
R_API const char *r_print_byte_color(RPrint *p, ut64 addr, int ch) {
if (p->flags & R_PRINT_FLAGS_RAINBOW) {
if (p && p->flags & R_PRINT_FLAGS_RAINBOW) {
// EXPERIMENTAL
int bg = (p->flags & R_PRINT_FLAGS_NONHEX)? 48: 38;
snprintf (colorbuffer, sizeof (colorbuffer), "\033[%d;5;%dm", bg, ch);
@ -624,7 +624,7 @@ R_API const char *r_print_byte_color(RPrint *p, ut64 addr, int ch) {
return r;
}
}
const bool use_color = p->flags & R_PRINT_FLAGS_COLOR;
const bool use_color = (p && p->flags & R_PRINT_FLAGS_COLOR);
if (!use_color) {
return NULL;
}

View File

@ -1246,7 +1246,7 @@ R_API char *r_sys_whoami(void) {
return strdup ("?");
}
#elif __wasi__
strcpy (buf, "user");
return strdup ("user");
#elif HAVE_TH_LOCAL
char *user = r_sys_getenv ("USER");
return user? user: r_str_newf ("uid%d", getuid ());
@ -1258,8 +1258,8 @@ R_API char *r_sys_whoami(void) {
}
int uid = getuid ();
snprintf (buf, sizeof (buf), "uid%d", uid);
#endif
return strdup (buf);
#endif
}
R_API int r_sys_uid(void) {

View File

@ -36,6 +36,7 @@ static void *_r_th_launcher(void *_th) {
ret = th->fun (th);
if (ret < 0) {
// th has been freed
r_th_lock_leave (th->lock);
return 0;
}
r_th_set_running (th, false);