Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145143377
D12767.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
875 B
Referenced Files
None
Subscribers
None
D12767.diff
View Options
Index: head/libexec/rtld-elf/libmap.c
===================================================================
--- head/libexec/rtld-elf/libmap.c
+++ head/libexec/rtld-elf/libmap.c
@@ -100,6 +100,7 @@
{
struct lmc *p;
struct stat st;
+ ssize_t retval;
int fd;
char *lm_map;
@@ -128,10 +129,11 @@
}
}
- lm_map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
- if (lm_map == (const char *)MAP_FAILED) {
+ lm_map = xmalloc(st.st_size);
+ retval = read(fd, lm_map, st.st_size);
+ if (retval != st.st_size) {
close(fd);
- dbg("lm_parse_file: mmap(\"%s\") failed, %s", path,
+ dbg("lm_parse_file: read(\"%s\") failed, %s", path,
rtld_strerror(errno));
return;
}
@@ -142,7 +144,7 @@
p->ino = st.st_ino;
TAILQ_INSERT_HEAD(&lmc_head, p, next);
lmc_parse(lm_map, st.st_size);
- munmap(lm_map, st.st_size);
+ free(lm_map);
}
static void
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 17, 10:10 AM (4 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28811081
Default Alt Text
D12767.diff (875 B)
Attached To
Mode
D12767: Use xmalloc+read instead of mmap(2) to read in libmap.conf(5)
Attached
Detach File
Event Timeline
Log In to Comment