also advance cur if upstream is a bytestream or an iobuf

master
leitner 4 years ago
parent 93a13274e0
commit 6ca4390c8e

@ -19,7 +19,13 @@ ssize_t prs_readblob(struct bytestream* bs,unsigned char* dest,size_t destlen) {
break; break;
case IOBUF: case IOBUF:
buffer_get(bs->u.b, (char*)dest, destlen); r=buffer_get(bs->u.b, (char*)dest, destlen);
if (r != (ssize_t)destlen) {
bs->cur = 1; // set bytestream to error state
bs->max = 0;
return -1;
}
bs->cur += r;
break; break;
case BSTREAM: case BSTREAM:
@ -30,6 +36,7 @@ ssize_t prs_readblob(struct bytestream* bs,unsigned char* dest,size_t destlen) {
bs->max = 0; bs->max = 0;
return -1; return -1;
} }
bs->cur += r;
break; break;
} }

Loading…
Cancel
Save