fiasco: Fix fiasco_write_to_file
This commit is contained in:
1 parent
f8ad95ee4d
commit
28ca666c6e
1 file changed
+2
-4
+2
-4
@@ -353,7 +353,7 @@ int fiasco_write_to_file(struct fiasco * fiasco, const char * file) {
|
|||||||
device_hwrevs_bufs = device_list_alloc_to_bufs(image->devices);
|
device_hwrevs_bufs = device_list_alloc_to_bufs(image->devices);
|
||||||
|
|
||||||
device_count = 0;
|
device_count = 0;
|
||||||
if ( device_hwrevs_bufs )
|
if ( device_hwrevs_bufs && device_hwrevs_bufs[0] )
|
||||||
for ( ; device_hwrevs_bufs[device_count]; ++device_count );
|
for ( ; device_hwrevs_bufs[device_count]; ++device_count );
|
||||||
|
|
||||||
if ( ! type )
|
if ( ! type )
|
||||||
@@ -371,7 +371,7 @@ int fiasco_write_to_file(struct fiasco * fiasco, const char * file) {
|
|||||||
WRITE_OR_FAIL(file, fd, "T", 1);
|
WRITE_OR_FAIL(file, fd, "T", 1);
|
||||||
|
|
||||||
/* number of subsections */
|
/* number of subsections */
|
||||||
length8 = device_count;
|
length8 = device_count+1;
|
||||||
if ( image->version )
|
if ( image->version )
|
||||||
++length8;
|
++length8;
|
||||||
if ( image->layout )
|
if ( image->layout )
|
||||||
@@ -406,13 +406,11 @@ int fiasco_write_to_file(struct fiasco * fiasco, const char * file) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* append device & hwrevs subsection */
|
/* append device & hwrevs subsection */
|
||||||
if ( device_hwrevs_bufs ) {
|
|
||||||
for ( i = 0; i < device_count; ++i ) {
|
for ( i = 0; i < device_count; ++i ) {
|
||||||
WRITE_OR_FAIL(file, fd, "2", 1); /* 2 - device & hwrevs */
|
WRITE_OR_FAIL(file, fd, "2", 1); /* 2 - device & hwrevs */
|
||||||
WRITE_OR_FAIL(file, fd, &device_hwrevs_bufs[i][0], 1);
|
WRITE_OR_FAIL(file, fd, &device_hwrevs_bufs[i][0], 1);
|
||||||
WRITE_OR_FAIL(file, fd, device_hwrevs_bufs[i]+1, device_hwrevs_bufs[i][0]);
|
WRITE_OR_FAIL(file, fd, device_hwrevs_bufs[i]+1, device_hwrevs_bufs[i][0]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
free(device_hwrevs_bufs);
|
free(device_hwrevs_bufs);
|
||||||
|
|
||||||
/* append layout subsection */
|
/* append layout subsection */
|
||||||
|
|||||||
Reference in new issue
Block a user