1
0
mirror of https://github.com/moparisthebest/curl synced 2025-02-28 09:21:50 -05:00

curl_slist_append.3: add error checking to the example

This commit is contained in:
Daniel Stenberg 2015-08-05 14:28:21 +02:00
parent 33de75ed63
commit 9947f259bf

View File

@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___ .\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____| .\" * \___|\___/|_| \_\_____|
.\" * .\" *
.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. .\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" * .\" *
.\" * This software is licensed as described in the file COPYING, which .\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms .\" * you should have received as part of this distribution. The terms
@ -46,6 +46,10 @@ pointer is returned.
struct curl_slist *slist=NULL; struct curl_slist *slist=NULL;
slist = curl_slist_append(slist, "pragma:"); slist = curl_slist_append(slist, "pragma:");
if (slist == NULL)
return -1;
curl_easy_setopt(handle, CURLOPT_HTTPHEADER, slist); curl_easy_setopt(handle, CURLOPT_HTTPHEADER, slist);
curl_easy_perform(handle); curl_easy_perform(handle);