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
This commit is contained in:
Daniel Gustafsson 2018-04-24 22:42:41 +02:00 committed by Daniel Stenberg
parent 3c630f9b0a
commit 732d093835
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
1 changed files with 4 additions and 0 deletions

View File

@ -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;