Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107138355
D40076.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
912 B
Referenced Files
None
Subscribers
None
D40076.diff
View Options
diff --git a/usr.sbin/bhyve/qemu_fwcfg.c b/usr.sbin/bhyve/qemu_fwcfg.c
--- a/usr.sbin/bhyve/qemu_fwcfg.c
+++ b/usr.sbin/bhyve/qemu_fwcfg.c
@@ -524,6 +524,7 @@
struct qemu_fwcfg_user_file *fwcfg_file;
struct stat sb;
const char *opt_ptr, *opt_end;
+ ssize_t bytes_read;
int fd;
fwcfg_file = malloc(sizeof(*fwcfg_file));
@@ -593,16 +594,14 @@
close(fd);
return (ENOMEM);
}
- fwcfg_file->size = read(fd, fwcfg_file->data, sb.st_size);
- if ((ssize_t)fwcfg_file->size < 0) {
+ bytes_read = read(fd, fwcfg_file->data, sb.st_size);
+ if (bytes_read < 0 || bytes_read != sb.st_size) {
warn("Unable to read file \"%s\"", opt_ptr);
free(fwcfg_file->data);
close(fd);
return (-1);
- } else if (fwcfg_file->size < sb.st_size) {
- warnx("Only read %u bytes of file \"%s\"",
- fwcfg_file->size, opt_ptr);
}
+ fwcfg_file->size = bytes_read;
close(fd);
} else {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 11, 5:24 PM (20 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15756043
Default Alt Text
D40076.diff (912 B)
Attached To
Mode
D40076: bhyve: error out if fwcfg user file isn't read completely
Attached
Detach File
Event Timeline
Log In to Comment