Page MenuHomeFreeBSD

D40076.diff
No OneTemporary

D40076.diff

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

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)

Event Timeline