ref: 1aa00e4a1a8190a81d5d0101e088a290429a6bbd
parent: 8bc5e5735e42d4caff25f077466bd789f7e3ad8e
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);
--
⑨