From: Daniel Gustafsson Date: Tue, 24 Apr 2018 20:42:41 +0000 (+0200) Subject: cookies: ensure that we have cookies before writing jar X-Git-Tag: curl-7_60_0~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=732d093835b165e7534e09fad7ef09e0e6098566;p=thirdparty%2Fcurl.git 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 --- diff --git a/lib/cookie.c b/lib/cookie.c index 9c90c2a385..5eb3c1209d 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;