snapfs: more informative error messages for malformed snapshots
[rsc] --rw-rw-r-- M 136171 glenda sys 4332 Mar 6 11:02 sys/src/cmd/snap/read.c
/n/sourcesdump/2006/0306/plan9/sys/src/cmd/snap/read.c:136,142 -
/n/sourcesdump/2006/0307/plan9/sys/src/cmd/snap/read.c:136,142
Page **pp;
int i, npg;
int t;
- int len;
+ int n, len;
ulong pid;
uvlong off;
char buf[Pagesize];
/n/sourcesdump/2006/0306/plan9/sys/src/cmd/snap/read.c:180,187 -
/n/sourcesdump/2006/0307/plan9/sys/src/cmd/snap/read.c:180,187
fprint(2, "0x%.8llux same as %s pid %lud 0x%.8llux\n", s->offset+i*Pagesize, t=='m'?"mem":"text", pid, off);
break;
case 'r':
- if(Bread(b, buf, len) != len)
- panic("error reading segment xx");
+ if((n=Bread(b, buf, len)) != len)
+ sysfatal("short read of segment %d/%d at %llx: %r", n, len, Boffset(b));
pp[i] = datapage(buf, len);
if(debug)
fprint(2, "0x%.8llux is raw data\n", s->offset+i*Pagesize);
|