Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F137706098
D27864.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D27864.id.diff
View Options
diff --git a/libexec/rtld-elf/libmap.c b/libexec/rtld-elf/libmap.c
--- a/libexec/rtld-elf/libmap.c
+++ b/libexec/rtld-elf/libmap.c
@@ -103,7 +103,7 @@
char *lm_map;
struct stat st;
ssize_t retval;
- int fd;
+ int fd, saved_errno;
TAILQ_FOREACH(p, &lmc_head, next) {
if (strcmp(p->path, path) == 0)
@@ -117,9 +117,9 @@
return;
}
if (fstat(fd, &st) == -1) {
- close(fd);
dbg("lm_parse_file: fstat(\"%s\") failed, %s", path,
rtld_strerror(errno));
+ close(fd);
return;
}
@@ -132,14 +132,19 @@
lm_map = xmalloc(st.st_size);
retval = read(fd, lm_map, st.st_size);
+ saved_errno = errno;
+ close(fd);
if (retval != st.st_size) {
- close(fd);
+ if (retval == -1) {
+ dbg("lm_parse_file: read(\"%s\") failed, %s", path,
+ rtld_strerror(saved_errno));
+ } else {
+ dbg("lm_parse_file: short read(\"%s\"), %zd vs %jd",
+ path, retval, (uintmax_t)st.st_size);
+ }
free(lm_map);
- dbg("lm_parse_file: read(\"%s\") failed, %s", path,
- rtld_strerror(errno));
return;
}
- close(fd);
p = xmalloc(sizeof(struct lmc));
p->path = xstrdup(path);
p->dev = st.st_dev;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 26, 1:21 AM (20 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26194555
Default Alt Text
D27864.id.diff (1 KB)
Attached To
Mode
D27864: Call close(2) after errno is used.
Attached
Detach File
Event Timeline
Log In to Comment