1
0
mirror of https://github.com/fumiama/simple-kanban.git synced 2026-06-18 16:30:25 +08:00

修复pthread带来的内存泄漏

This commit is contained in:
fumiama
2021-05-04 13:59:33 +08:00
parent 93255fd162
commit 3bfbacbdc5
2 changed files with 65 additions and 49 deletions

View File

@@ -37,7 +37,7 @@ void getMessage(void *p) {
}
}
off_t fileSize(const char* fname) {
off_t size_of_file(const char* fname) {
struct stat statbuf;
if(stat(fname, &statbuf)==0) return statbuf.st_size;
else return -1;
@@ -73,7 +73,7 @@ int main(int argc,char *argv[]) { //usage: ./client host port
fp = fopen(buf, "rb");
if(fp) {
off_t len = 0;
file_size = (uint32_t)fileSize(buf);
file_size = (uint32_t)size_of_file(buf);
#if __APPLE__
struct iovec headers;
headers.iov_base = &file_size;