svn commit: r339167 - stable/11/libexec/rtld-elf

Konstantin Belousov kib at FreeBSD.org
Wed Oct 3 17:29:31 UTC 2018


Author: kib
Date: Wed Oct  3 17:29:30 2018
New Revision: 339167
URL: https://svnweb.freebsd.org/changeset/base/339167

Log:
  MFC r324952 (by trasz):
  Replace lseek(2)/read(2) pair with pread(2).

Modified:
  stable/11/libexec/rtld-elf/rtld.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/libexec/rtld-elf/rtld.c
==============================================================================
--- stable/11/libexec/rtld-elf/rtld.c	Wed Oct  3 17:28:27 2018	(r339166)
+++ stable/11/libexec/rtld-elf/rtld.c	Wed Oct  3 17:29:30 2018	(r339167)
@@ -1823,10 +1823,9 @@ cleanup1:
 		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;
 		}


More information about the svn-src-all mailing list