From: fredrik Date: Thu, 3 Aug 2006 02:03:46 +0000 (+0000) Subject: Fix a bug where at may be inside buf. X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=487044bbce04292a029b57b04f54b3b9030688fd;p=vcfs.git Fix a bug where at may be inside buf. git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/vcfs@680 959494ce-11ee-0310-bf91-de5d638817bd --- diff --git a/store.c b/store.c index b8077d3..4d4f14f 100644 --- a/store.c +++ b/store.c @@ -79,18 +79,20 @@ int storeput(struct store *st, const void *buf, size_t len, struct addr *at) ssize_t storeget(struct store *st, void *buf, size_t len, struct addr *at) { ssize_t sz; + struct addr at2; - sz = cacheget(st, at, buf, len); + at2 = *at; + sz = cacheget(st, at2, buf, len); if(sz != -2) { if(sz == -1) errno = ENOENT; return(sz); } - sz = st->ops->get(st, buf, len, at); + sz = st->ops->get(st, buf, len, at2); if((sz < 0) && (errno == ENOENT)) - cacheput(st, at, NULL, -1); + cacheput(st, at2, NULL, -1); else if(sz >= 0) - cacheput(st, at, buf, sz); + cacheput(st, at2, buf, sz); return(sz); }