Replace lseek(2)/read(2) pair with pread(2), removing yet another syscall
from the binary startup code. MFC after: 2 weeks Sponsored by: DARPA, AFRL
This commit is contained in:
parent
1689a3c4ac
commit
2fe071d971
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=324952
@ -1824,10 +1824,9 @@ gethints(bool nostdlib)
|
||||
if (dl > hint_stat.st_size)
|
||||
goto cleanup1;
|
||||
p = xmalloc(hdr.dirlistlen + 1);
|
||||
|
||||
if (lseek(fd, hdr.strtab + hdr.dirlist, SEEK_SET) == -1 ||
|
||||
read(fd, p, hdr.dirlistlen + 1) !=
|
||||
(ssize_t)hdr.dirlistlen + 1 || p[hdr.dirlistlen] != '\0') {
|
||||
if (pread(fd, p, hdr.dirlistlen + 1,
|
||||
hdr.strtab + hdr.dirlist) != (ssize_t)hdr.dirlistlen + 1 ||
|
||||
p[hdr.dirlistlen] != '\0') {
|
||||
free(p);
|
||||
goto cleanup1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user