disk: Check if reading from block device failed
This commit is contained in:
1 parent
4bd0a47b22
commit
52793b733d
1 file changed
+5
@@ -270,6 +270,11 @@ int disk_dump_dev(int fd, const char * file) {
|
|||||||
size = read(fd, global_buf, need);
|
size = read(fd, global_buf, need);
|
||||||
if ( size == 0 )
|
if ( size == 0 )
|
||||||
break;
|
break;
|
||||||
|
if ( size < 0 ) {
|
||||||
|
PRINTF_ERROR("Reading from block device failed");
|
||||||
|
close(fd2);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
if ( write(fd2, global_buf, size) != size ) {
|
if ( write(fd2, global_buf, size) != size ) {
|
||||||
PRINTF_ERROR("Dumping image failed");
|
PRINTF_ERROR("Dumping image failed");
|
||||||
close(fd2);
|
close(fd2);
|
||||||
|
|||||||
Reference in new issue
Block a user