mirror of
https://github.com/curl/curl.git
synced 2026-08-26 06:43:31 +03:00
examples: check more errors, fix cleanups, scope variables
Inspired by Joshua's report on examples. Closes #19055
This commit is contained in:
parent
61dcb56743
commit
64ed2ea196
42 changed files with 874 additions and 785 deletions
|
|
@ -121,8 +121,6 @@ static int sftpResumeUpload(CURL *curlhandle, const char *remotepath,
|
|||
|
||||
int main(void)
|
||||
{
|
||||
const char *remote = "sftp://user:pass@example.com/path/filename";
|
||||
const char *filename = "filename";
|
||||
CURL *curlhandle = NULL;
|
||||
|
||||
CURLcode res = curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
|
@ -130,12 +128,16 @@ int main(void)
|
|||
return (int)res;
|
||||
|
||||
curlhandle = curl_easy_init();
|
||||
if(curlhandle) {
|
||||
const char *remote = "sftp://user:pass@example.com/path/filename";
|
||||
const char *filename = "filename";
|
||||
|
||||
if(!sftpResumeUpload(curlhandle, remote, filename)) {
|
||||
printf("resumed upload using curl %s failed\n", curl_version());
|
||||
if(!sftpResumeUpload(curlhandle, remote, filename)) {
|
||||
printf("resumed upload using curl %s failed\n", curl_version());
|
||||
}
|
||||
|
||||
curl_easy_cleanup(curlhandle);
|
||||
}
|
||||
|
||||
curl_easy_cleanup(curlhandle);
|
||||
curl_global_cleanup();
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue