Check return value of fseek for errors.

This commit is contained in:
Roger A. Light 2014-09-23 00:45:12 +01:00
parent 84214bcd99
commit 950c4ed9c6

View File

@ -475,7 +475,11 @@ static int callback_http(struct libwebsocket_context *context,
}
wlen = libwebsocket_write(wsi, buf, buflen, LWS_WRITE_HTTP);
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{
if(buflen < sizeof(buf)){
fclose(u->fptr);