PERFORCE change 164251 for review

Robert Watson rwatson at FreeBSD.org
Sat Jun 13 09:55:28 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=164251

Change 164251 by rwatson at rwatson_freebsd_capabilities on 2009/06/13 09:55:15

	Rather than encode a requirement that shared object file descriptors
	be at offset 0, pread() at offset 0 to get the ELF header.  The
	remainder of rtld-elf makes no use of file offsets, since it uses
	mmap to load actual ELF sections.

Affected files ...

.. //depot/projects/trustedbsd/capabilities/src/libexec/rtld-elf/map_object.c#5 edit

Differences ...

==== //depot/projects/trustedbsd/capabilities/src/libexec/rtld-elf/map_object.c#5 (text+ko) ====

@@ -44,7 +44,8 @@
 
 /*
  * Map a shared object into memory.  The "fd" argument is a file descriptor,
- * which must be open on the object and positioned at its beginning.
+ * which must be open on the object.
+ *
  * The "path" argument is a pathname that is used only for error messages.
  *
  * The return value is a pointer to a newly-allocated Obj_Entry structure
@@ -270,7 +271,7 @@
     } u;
     ssize_t nbytes;
 
-    if ((nbytes = read(fd, u.buf, PAGE_SIZE)) == -1) {
+    if ((nbytes = pread(fd, u.buf, PAGE_SIZE, 0)) == -1) {
 	_rtld_error("%s: read error: %s", path, strerror(errno));
 	return NULL;
     }


More information about the p4-projects mailing list