libmach: substitute /dev/zero for /proc/$pid/fpregs when missing (for snapfs)

front
cinap_lenrek 2018-09-08 23:31:30 +02:00
parent 97a2e35a0c
commit e534c4147e
1 changed files with 2 additions and 5 deletions

View File

@ -108,11 +108,8 @@ attachproc(int pid, int kflag, int corefd, Fhdr *fp)
if (mach->fpregsize) {
sprint(buf, "/proc/%d/fpregs", pid);
fd = open(buf, mode);
if(fd < 0) {
close(map->seg[0].fd);
free(map);
return 0;
}
if(fd < 0)
fd = open("/dev/zero", OREAD);
setmap(map, fd, mach->regsize, mach->regsize+mach->fpregsize, 0, "fpregs");
}
setmap(map, corefd, fp->txtaddr, fp->txtaddr+fp->txtsz, fp->txtaddr, "text");