Check return value of fseek for errors.
This commit is contained in:
parent
84214bcd99
commit
950c4ed9c6
@ -475,7 +475,11 @@ static int callback_http(struct libwebsocket_context *context,
|
|||||||
}
|
}
|
||||||
wlen = libwebsocket_write(wsi, buf, buflen, LWS_WRITE_HTTP);
|
wlen = libwebsocket_write(wsi, buf, buflen, LWS_WRITE_HTTP);
|
||||||
if(wlen < buflen){
|
if(wlen < buflen){
|
||||||
fseek(u->fptr, buflen-wlen, SEEK_CUR);
|
if(fseek(u->fptr, buflen-wlen, SEEK_CUR) < 0){
|
||||||
|
fclose(u->fptr);
|
||||||
|
u->fptr = NULL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
if(buflen < sizeof(buf)){
|
if(buflen < sizeof(buf)){
|
||||||
fclose(u->fptr);
|
fclose(u->fptr);
|
||||||
|
Loading…
Reference in New Issue
Block a user