From 40cf8119dc2b83214c4d29fc8b85df9c4874e273 Mon Sep 17 00:00:00 2001 From: kib Date: Wed, 3 Oct 2018 17:29:30 +0000 Subject: [PATCH] MFC r324952 (by trasz): Replace lseek(2)/read(2) pair with pread(2). --- libexec/rtld-elf/rtld.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 58c6e4f186e..f4cfcda9b03 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -1823,10 +1823,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; } -- 2.45.0