Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Oct 2018 17:29:31 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r339167 - stable/11/libexec/rtld-elf
Message-ID:  <201810031729.w93HTVJB015793@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201810031729.w93HTVJB015793>