Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
linyacool authored Jun 20, 2018
1 parent cdd5bbe commit e2a9d02
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion WebServer/HttpData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,15 @@ AnalysisState HttpData::analysisRequest()
handleError(fd_, 404, "Not Found!");
return ANALYSIS_ERROR;
}
char *src_addr = static_cast<char*>(mmap(NULL, sbuf.st_size, PROT_READ, MAP_PRIVATE, src_fd, 0));
void *mmapRet = mmap(NULL, sbuf.st_size, PROT_READ, MAP_PRIVATE, src_fd, 0);
close(src_fd);
if (mmapRet == (void *)-1)
{
outBuffer_.clear();
handleError(fd_, 404, "Not Found!");
return ANALYSIS_ERROR;
}
char *src_addr = static_cast<char*>(mmapRet);
outBuffer_ += string(src_addr, src_addr + sbuf.st_size);;
munmap(src_addr, sbuf.st_size);
return ANALYSIS_SUCCESS;
Expand Down

0 comments on commit e2a9d02

Please sign in to comment.