Skip to content

Commit

Permalink
Dont seek from the server side rap ##io
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Jun 10, 2024
1 parent 34dd9e0 commit e6e131f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libr/core/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3889,7 +3889,7 @@ R_API bool r_core_serve(RCore *core, RIODesc *file) {
} else {
pipefd = -1;
}
R_LOG_ERROR ("(flags: %d) len: %d filename: '%s'", flg, cmd, ptr);
R_LOG_INFO ("(flags: %d) len: %d filename: '%s'", flg, cmd, ptr);
} else {
pipefd = -1;
R_LOG_ERROR ("Cannot open file (%s)", ptr);
Expand Down
17 changes: 15 additions & 2 deletions libr/io/p/io_rap.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ static bool __rap_close(RIODesc *desc) {

static ut64 __rap_lseek(RIO *io, RIODesc *fd, ut64 offset, int whence) {
RSocket *s = RIORAP_FD (fd);
if (RIORAP_IS_LISTEN (fd)) {
switch (whence) {
case R_IO_SEEK_SET:
io->off = offset;
break;
case R_IO_SEEK_CUR:
io->off += offset;
break;
case R_IO_SEEK_END:
io->off = UT64_MAX;
}
return io->off;
}
return r_socket_rap_client_seek (s, offset, whence);
}

Expand All @@ -62,7 +75,7 @@ static bool __rap_plugin_open(RIO *io, const char *pathname, bool many) {
}

static RIODesc *__rap_open(RIO *io, const char *pathname, int rw, int mode) {
int i, listenmode;
int i;
char *port;

if (!__rap_plugin_open (io, pathname, 0)) {
Expand All @@ -74,7 +87,7 @@ static RIODesc *__rap_open(RIO *io, const char *pathname, int rw, int mode) {
R_LOG_ERROR ("rap: wrong uri");
return NULL;
}
listenmode = (*host == ':');
int listenmode = (*host == ':');
*port++ = 0;
if (!*port) {
return NULL;
Expand Down
3 changes: 2 additions & 1 deletion libr/socket/socket_rap_client.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2011-2023 - pancake */
/* radare - LGPL - Copyright 2011-2024 - pancake */

#include <r_socket.h>
#include <r_util.h>
Expand Down Expand Up @@ -177,6 +177,7 @@ R_API int r_socket_rap_client_read(RSocket *s, ut8 *buf, int count) {
}

R_API ut64 r_socket_rap_client_seek(RSocket *s, ut64 offset, int whence) {
R_RETURN_VAL_IF_FAIL (s, UT64_MAX);
ut8 tmp[10];
tmp[0] = RAP_PACKET_SEEK;
tmp[1] = (ut8)whence;
Expand Down

0 comments on commit e6e131f

Please sign in to comment.