ref: 511cee2f223812000c19acb4dd80f161c6b48f63
parent: e41faad5a687fb5f542e0723cdd853eb41652f7a
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Jan 15 23:46:52 EST 2015
webcookies: only sync the jar when dirty on clunk avoid sync the jar file when fids get clunked. the only reason to sync the jar on clunk is when it has been marked dirty (cookies added or deleted) and we want to flush the changes to disk.
--- a/sys/src/cmd/webcookies.c
+++ b/sys/src/cmd/webcookies.c
@@ -483,8 +483,9 @@
if(jar == nil)
return;
expirejar(jar, 0);
- if(syncjar(jar) < 0)
- fprint(2, "warning: cannot rewrite cookie jar: %r\n");
+ if(jar->dirty)
+ if(syncjar(jar) < 0)
+ fprint(2, "warning: cannot rewrite cookie jar: %r\n");
for(i=0; i<jar->nc; i++)
freecookie(&jar->c[i]);
@@ -1208,7 +1209,8 @@
delcookie(jar, &jar->c[i]);
break;
}
- syncjar(jar);
+ if(jar->dirty)
+ syncjar(jar);
free(a->dom);
free(a->path);
free(a->inhttp);