initrd driver now properly handles a request to read more data than available
This commit is contained in:
parent
ff2dbb91e1
commit
edfb52936d
@ -19,13 +19,7 @@ void read(void* args) {
|
|||||||
rpc_deallocate_buf(args,state.sizeorpos);
|
rpc_deallocate_buf(args,state.sizeorpos);
|
||||||
long max_data=initrd_size-pos;
|
long max_data=initrd_size-pos;
|
||||||
if (size>max_data) {
|
if (size>max_data) {
|
||||||
serial_print("Reading too much data from initrd\n");
|
size=max_data;
|
||||||
state.buf=NULL;
|
|
||||||
state.sizeorpos=0;
|
|
||||||
serialize_int(0,&state);
|
|
||||||
rpc_return(state.buf,state.sizeorpos);
|
|
||||||
free(state.buf);
|
|
||||||
pthread_exit(NULL);
|
|
||||||
}
|
}
|
||||||
char* data=malloc(sizeof(char)*size);
|
char* data=malloc(sizeof(char)*size);
|
||||||
for (long i=0;i<size;i++) {
|
for (long i=0;i<size;i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user