diff options
author | Curl Upstream <curl-library@lists.haxx.se> | 2022-04-27 06:11:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-04-28 19:15:44 (GMT) |
commit | 2a9bc9ebf09fbafa5378d143083434204e9f233e (patch) | |
tree | d55420489c10068efaa694b96db2f735539b4339 /lib/cookie.c | |
parent | a1f6ec647cfab8d613897562f8ee5f81a8f6b68d (diff) | |
download | CMake-2a9bc9ebf09fbafa5378d143083434204e9f233e.zip CMake-2a9bc9ebf09fbafa5378d143083434204e9f233e.tar.gz CMake-2a9bc9ebf09fbafa5378d143083434204e9f233e.tar.bz2 |
curl 2022-04-27 (1669b17d)
Code extracted from:
https://github.com/curl/curl.git
at commit 1669b17d3a1a1fd824308544ca0ec02a2a4f50ea (curl-7_83_0).
Diffstat (limited to 'lib/cookie.c')
-rw-r--r-- | lib/cookie.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/cookie.c b/lib/cookie.c index d418efa..451881f 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -1188,12 +1188,15 @@ struct CookieInfo *Curl_cookie_init(struct Curl_easy *data, fp = stdin; fromfile = FALSE; } - else if(file && !*file) { - /* points to a "" string */ + else if(!file || !*file) { + /* points to an empty string or NULL */ fp = NULL; } - else - fp = file?fopen(file, FOPEN_READTEXT):NULL; + else { + fp = fopen(file, FOPEN_READTEXT); + if(!fp) + infof(data, "WARNING: failed to open cookie file \"%s\"", file); + } c->newsession = newsession; /* new session? */ @@ -1227,7 +1230,7 @@ struct CookieInfo *Curl_cookie_init(struct Curl_easy *data, */ remove_expired(c); - if(fromfile) + if(fromfile && fp) fclose(fp); } |