Skip to content

Commit

Permalink
fix frequent segfaults
Browse files Browse the repository at this point in the history
  • Loading branch information
bakatrouble committed Jan 28, 2020
1 parent ca70c70 commit 08813a7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/upload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ bool sendFileToServer(Config &conf, string &path, size_t size) {
fs::path fpath(path);

FILE *f = fopen(path.c_str(), "rb");

if (f == nullptr) {
cout << "fopen() failed" << endl;
return false;
}

struct upload_info ui = { f, size };

CURL *curl = curl_easy_init();
Expand Down Expand Up @@ -72,5 +78,6 @@ bool sendFileToServer(Config &conf, string &path, size_t size) {
return false;
}
}
cout << "curl_easy_init() failed" << endl;
return false;
}

0 comments on commit 08813a7

Please sign in to comment.