/* strip comments (different generation days) */
comment = g_strstr_len(asl->str, asl->len, COMMENT_END);
if (comment) {
- asl = g_string_erase(asl, 0, comment + sizeof(COMMENT_END) - asl->str);
+ comment += strlen(COMMENT_END);
+ while (*comment == '\n') {
+ comment++;
+ }
+ asl = g_string_erase(asl, 0, comment - asl->str);
}
/* strip def block name (it has file path in it) */
uint8_t signature_high;
uint16_t signature;
int i;
- const char *device = "";
- if (!g_strcmp0(data->machine, MACHINE_Q35)) {
- device = ",id=hd -device ide-hd,drive=hd";
- }
+ args = g_strdup_printf("-net none -display none %s "
+ "-drive id=hd0,if=none,file=%s,format=raw "
+ "-device ide-hd,drive=hd0 ",
+ params ? params : "", disk);
- args = g_strdup_printf("-net none -display none %s -drive file=%s%s,",
- params ? params : "", disk, device);
qtest_start(args);
/* Wait at most 1 minute */
const char *arch = qtest_get_arch();
FILE *f = fopen(disk, "w");
int ret;
+
+ if (!f) {
+ fprintf(stderr, "Couldn't open \"%s\": %s", disk, strerror(errno));
+ return 1;
+ }
fwrite(boot_sector, 1, sizeof boot_sector, f);
fclose(f);