mirror of
https://github.com/0intro/wmii
synced 2024-12-17 09:02:37 +03:00
fixed data excess issues on rootdir read
This commit is contained in:
parent
048e3e7c0c
commit
3eefa8b843
@ -426,6 +426,7 @@ xread(IXPReq *r)
|
||||
IXPMap *m = ixp_server_fid2map(r, r->fcall->fid);
|
||||
unsigned char *p = r->fcall->data;
|
||||
unsigned short i;
|
||||
unsigned int len;
|
||||
char buf[32];
|
||||
|
||||
if(!m) {
|
||||
@ -434,7 +435,9 @@ xread(IXPReq *r)
|
||||
}
|
||||
i = qpath_item(m->qid.path);
|
||||
r->fcall->count = 0; /* EOF by default */
|
||||
if(!r->fcall->offset) {
|
||||
r->fcall->id = RREAD;
|
||||
if(r->fcall->offset)
|
||||
return 0;
|
||||
switch (qpath_type(m->qid.path)) {
|
||||
case Droot:
|
||||
r->fcall->count = type_to_stat(&stat, "ctl", 0);
|
||||
@ -451,7 +454,10 @@ xread(IXPReq *r)
|
||||
p = ixp_enc_stat(p, &stat);
|
||||
for(i = 1; i < nitem; i++) {
|
||||
snprintf(buf, sizeof(buf), "%u", i);
|
||||
r->fcall->count += type_to_stat(&stat, buf, i);
|
||||
len = type_to_stat(&stat, buf, i);
|
||||
if(r->fcall->count + len >= r->fcall->iounit)
|
||||
break;
|
||||
r->fcall->count += len;
|
||||
p = ixp_enc_stat(p, &stat);
|
||||
}
|
||||
break;
|
||||
@ -521,8 +527,6 @@ error_xread:
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
r->fcall->id = RREAD;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user