]> granicus.if.org Git - curl/commitdiff
cookies: ensure that we have cookies before writing jar
authorDaniel Gustafsson <daniel@yesql.se>
Tue, 24 Apr 2018 20:42:41 +0000 (22:42 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 25 Apr 2018 06:20:24 +0000 (08:20 +0200)
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

lib/cookie.c

index 9c90c2a385864e8f6fbab49e81212e7abae0000a..5eb3c1209db39a9ddbbac7be571de9929b0d4a08 100644 (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;