diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-01-16 04:46:52 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-01-16 04:46:52 +0100 |
commit | 511cee2f223812000c19acb4dd80f161c6b48f63 (patch) | |
tree | ef489bfe271dce90b68aa186deb38c318616bef9 /sys | |
parent | e41faad5a687fb5f542e0723cdd853eb41652f7a (diff) |
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.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/src/cmd/webcookies.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/src/cmd/webcookies.c b/sys/src/cmd/webcookies.c index 11a1887fa..02945ad19 100644 --- a/sys/src/cmd/webcookies.c +++ b/sys/src/cmd/webcookies.c @@ -483,8 +483,9 @@ closejar(Jar *jar) 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 @@ fsdestroyfid(Fid *fid) delcookie(jar, &jar->c[i]); break; } - syncjar(jar); + if(jar->dirty) + syncjar(jar); free(a->dom); free(a->path); free(a->inhttp); |