venti/copy: fix bug writing directories that zero truncate

Found by nwf.

TBR=rsc
https://codereview.appspot.com/162860045
This commit is contained in:
Russ Cox 2014-10-21 07:25:13 -04:00
parent 72197f89d4
commit 2763a6d832
2 changed files with 2 additions and 1 deletions

View file

@ -37,6 +37,7 @@ Mathieu Lonjaret <lejatorn@gmail.com>
Mathieu Lonjaret <mathieu.lonjaret@gmail.com> Mathieu Lonjaret <mathieu.lonjaret@gmail.com>
Michael Teichgräber <mt4swm@googlemail.com> Michael Teichgräber <mt4swm@googlemail.com>
Michael Teichgräber <mt@ib.wmipf.de> Michael Teichgräber <mt@ib.wmipf.de>
Nathaniel W Filardo <nwf@cs.jhu.edu> <nwfilardo@gmail.com>
Nikolai Saoukh <nikolai.saoukh@gmail.com> Nikolai Saoukh <nikolai.saoukh@gmail.com>
Yuval Pavel Zholkover <paulzhol@gmail.com> Yuval Pavel Zholkover <paulzhol@gmail.com>
Peter Saveliev <svinota.saveliev@gmail.com> Peter Saveliev <svinota.saveliev@gmail.com>

View file

@ -136,7 +136,7 @@ walk(uchar score[VtScoreSize], uint type, int base, int depth)
break; break;
case VtDirType: case VtDirType:
for(i=0; i<n/VtEntrySize; i++){ for(i=0; i*VtEntrySize < n; i++){
if(vtentryunpack(&e, buf, i) < 0){ if(vtentryunpack(&e, buf, i) < 0){
fprint(2, "warning: could not unpack entry #%d in %V %d\n", i, score, type); fprint(2, "warning: could not unpack entry #%d in %V %d\n", i, score, type);
continue; continue;