Dont seek from the server side rap ##io

This commit is contained in:
pancake 2024-06-10 19:09:42 +02:00 committed by pancake
parent 34dd9e0b2d
commit b3847c4a92
3 changed files with 18 additions and 4 deletions

View File

@ -3889,7 +3889,7 @@ reaccept:
} 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);

View File

@ -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);
}
@ -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)) {
@ -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;

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2011-2023 - pancake */
/* radare - LGPL - Copyright 2011-2024 - pancake */
#include <r_socket.h>
#include <r_util.h>
@ -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;