diff --git a/libr/core/cmd_info.c b/libr/core/cmd_info.c index 337d8b0cdd..8932c21431 100644 --- a/libr/core/cmd_info.c +++ b/libr/core/cmd_info.c @@ -155,7 +155,8 @@ static int cmd_info(void *data, const char *input) { if (mode == R_CORE_BIN_JSON) r_cons_printf ("{\"bin\":"); r_core_bin_info (core, R_CORE_BIN_ACC_INFO, mode, va, NULL, offset); - r_cons_printf (",\"core\":"); + if (mode == R_CORE_BIN_JSON) + r_cons_printf (",\"core\":"); r_core_file_info (core, mode); if (mode == R_CORE_BIN_JSON) r_cons_printf ("}\n"); diff --git a/libr/core/visual.c b/libr/core/visual.c index 8061f8f86f..1b49337ba1 100644 --- a/libr/core/visual.c +++ b/libr/core/visual.c @@ -63,7 +63,7 @@ static void r_core_visual_mark_seek(RCore *core, ut8 ch) { static void r_core_visual_mark(RCore *core, ut8 ch) { if (!marks_init) { int i; - for (i=0;i0) eprintf ("ok\n"); +#if 0 /* Read meta info */ r_socket_read (rap_fd, (ut8 *)&buf, 4); r_mem_copyendian ((ut8 *)&i, (ut8*)buf, 4, ENDIAN); @@ -217,11 +220,12 @@ static RIODesc *rap__open(struct r_io_t *io, const char *pathname, int rw, int m r_mem_copyendian ((ut8 *)&i, (ut8*)buf, 4, ENDIAN); i -= n; } +#endif } else { r_socket_free (rap_fd); return NULL; } - r_socket_free (rap_fd); + //r_socket_free (rap_fd); return r_io_desc_new (&r_io_plugin_rap, rior->fd->fd, pathname, rw, mode, rior); } diff --git a/libr/lang/lang.c b/libr/lang/lang.c index 4788650c49..ebd4726cd8 100644 --- a/libr/lang/lang.c +++ b/libr/lang/lang.c @@ -1,4 +1,4 @@ -/* radare - LGPL - Copyright 2009-2012 pancake */ +/* radare - LGPL - Copyright 2009-2012 - pancake */ #include #include diff --git a/libr/socket/socket.c b/libr/socket/socket.c index bf10ec78ca..b6c9f8f6f0 100644 --- a/libr/socket/socket.c +++ b/libr/socket/socket.c @@ -160,8 +160,13 @@ R_API int r_socket_connect (RSocket *s, const char *host, const char *port, int r_socket_block_time (s, 1, timeout); //fcntl (s->fd, F_SETFL, O_NONBLOCK, 1); ret = connect (s->fd, rp->ai_addr, rp->ai_addrlen); - if (timeout<1 && ret != -1) - break; + if (timeout<1) { + if (ret == -1) { + close (s->fd); + return R_FALSE; + } + return R_TRUE; + } if (timeout>0) { struct timeval tv; fd_set fdset; @@ -172,21 +177,24 @@ R_API int r_socket_connect (RSocket *s, const char *host, const char *port, int if (select (s->fd + 1, NULL, &fdset, NULL, &tv) == 1) { int so_error; socklen_t len = sizeof so_error; - ret = getsockopt (s->fd, SOL_SOCKET, SO_ERROR, &so_error, &len); + ret = getsockopt (s->fd, SOL_SOCKET, + SO_ERROR, &so_error, &len); // fcntl (s->fd, F_SETFL, O_NONBLOCK, 0); -r_socket_block_time (s, 0, 0); +// r_socket_block_time (s, 0, 0); + freeaddrinfo (res); + return R_TRUE; } else { + freeaddrinfo (res); close (s->fd); return R_FALSE; } } - //rp = NULL; close (s->fd); s->fd = -1; } freeaddrinfo (res); if (rp == NULL) { - //eprintf ("Could not connect\n"); + eprintf ("Could not resolve address\n"); return R_FALSE; } } @@ -336,11 +344,9 @@ R_API int r_socket_block_time (RSocket *s, int block, int sec) { #if __UNIX__ { int flags = fcntl (s->fd, F_GETFL, 0); - if (block) { - fcntl (s->fd, F_SETFL, flags & ~O_NONBLOCK); - } else { - fcntl (s->fd, F_SETFL, flags | O_NONBLOCK); - } + fcntl (s->fd, F_SETFL, block? + (flags & ~O_NONBLOCK): + (flags | O_NONBLOCK)); } #elif __WINDOWS__ ioctlsocket (s->fd, FIONBIO, (u_long FAR*)&block);