summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gustafsson <daniel@yesql.se>2018-04-24 22:42:41 +0200
committerDaniel Stenberg <daniel@haxx.se>2018-04-25 08:20:24 +0200
commit732d093835b165e7534e09fad7ef09e0e6098566 (patch)
tree4ddb23a511c8f6f01ccbf84d24ff5509e6d97b4f
parent3c630f9b0af097663a64e5c875c580aa9808a92b (diff)
downloadcurl-732d093835b165e7534e09fad7ef09e0e6098566.tar.gz
cookies: ensure that we have cookies before writing jar
The jar should be written iff there are cookies, so ensure that we still have cookies after expiration to avoid creating an empty file. Closes #2529
-rw-r--r--lib/cookie.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/cookie.c b/lib/cookie.c
index 9c90c2a38..5eb3c1209 100644
--- a/lib/cookie.c
+++ b/lib/cookie.c
@@ -1442,6 +1442,10 @@ static int cookie_output(struct CookieInfo *c, const char *dumphere)
/* at first, remove expired cookies */
remove_expired(c);
+ /* make sure we still have cookies after expiration */
+ if(0 == c->numcookies)
+ return 0;
+
if(!strcmp("-", dumphere)) {
/* use stdout */
out = stdout;