Fix resize command and more make race conditions

This commit is contained in:
pancake 2012-08-14 01:25:50 +02:00
parent 09642b4eec
commit 10b4b5546c
9 changed files with 19 additions and 12 deletions

View File

@ -4,7 +4,8 @@ CFLAGS+=-DCORELIB -Iarch/include -Iarch -I../../shlr
include ../config.mk
foo: pre ${LIBSO} ${LIBAR} plugins
foo:
@for a in pre ${LIBSO} ${LIBAR} plugins ; do ${MAKE} $$a ; done
include ${STATIC_ASM_PLUGINS}
STATIC_OBJS=$(subst ..,p/..,$(subst asm_,p/asm_,$(STATIC_OBJ)))

View File

@ -6,7 +6,8 @@ include ../config.mk
CFLAGS+=-DCORELIB
foo: ${LIBSO} ${LIBAR} plugins
foo:
for a in ${LIBSO} ${LIBAR} plugins ; do ${MAKE} $$a ; done
include ${STATIC_CMD_PLUGINS}
STATIC_OBJS=$(subst ..,p/..,$(subst cmd_,p/cmd_,$(STATIC_OBJ)))

View File

@ -282,7 +282,7 @@ static int cmd_resize(void *data, const char *input) {
" r+num insert num bytes, move following data up\n");
return R_TRUE;
default:
newsize = r_num_math (core->num, input+1);
newsize = r_num_math (core->num, input);
}
grow = (newsize > oldsize);

View File

@ -126,8 +126,11 @@ static int cmd_write(void *data, const char *input) {
case ' ':
/* write string */
len = r_str_escape (str);
r_core_write_at (core, core->offset, str, len);
#if 0
r_io_set_fd (core->io, core->file->fd);
r_io_write_at (core->io, core->offset, (const ut8*)str, len);
#endif
WSEEK (core, len);
r_core_block_read (core, 0);
break;

View File

@ -138,6 +138,7 @@ R_API int r_core_write_at(RCore *core, ut64 addr, const ut8 *buf, int size) {
if (addr >= core->offset && addr <= core->offset+core->blocksize)
r_core_block_read (core, 0);
}
core->file->size = r_io_size (core->io);
return (ret==-1)? R_FALSE: R_TRUE;
}

View File

@ -4,7 +4,8 @@ CFLAGS+=-DCORELIB
include ../config.mk
foo: pre libr_crypto.${EXT_SO} libr_crypto.${EXT_AR} plugins
foo:
for a in pre libr_crypto.${EXT_SO} libr_crypto.${EXT_AR} plugins ; do ${MAKE} $$a ; done
include ${STATIC_CRYPTO_PLUGINS}
STATIC_OBJS=$(subst ..,p/..,$(subst crypto_,p/crypto_,$(STATIC_OBJ)))

View File

@ -10,8 +10,8 @@ OBJ+=emit_arm.o
OBJ+=emit_x64.o
OBJ+=emit_trace.o
foo: ${LIBSO} ${LIBAR}
${MAKE} all
foo:
for a in ${LIBSO} ${LIBAR} all ; do ${MAKE} $$a ; done
P=p/
include ${STATIC_EGG_PLUGINS}

View File

@ -8,7 +8,8 @@ LDFLAGS+=p/grub/libgrubfs.a
include ../config.mk
EXTRA_TARGETS=plugins
foo: pre plugins ${LIBSO} ${LIBAR}
foo:
for a in pre plugins ${LIBSO} ${LIBAR} ; do ${MAKE} $$a ; done
include ${STATIC_FS_PLUGINS}
STATIC_OBJS=$(subst ..,p/..,$(subst fs_,p/fs_,$(STATIC_OBJ)))

View File

@ -144,12 +144,11 @@ R_API int r_io_set_fd(RIO *io, RIODesc *fd) {
R_API int r_io_set_fdn(RIO *io, int fd) {
if (fd != -1 && io->fd != NULL && fd != io->fd->fd) {
RIODesc *desc = r_io_desc_get (io, fd);
if (desc) {
if (!desc) return R_FALSE;
io->fd = desc;
io->plugin = desc->plugin;
return R_TRUE;
}
}
return R_FALSE;
}