summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/disk.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/disk.c b/src/disk.c
index f58b1dd..99fb7c8 100644
--- a/src/disk.c
+++ b/src/disk.c
@@ -270,6 +270,11 @@ int disk_dump_dev(int fd, const char * file) {
size = read(fd, global_buf, need);
if ( size == 0 )
break;
+ if ( size < 0 ) {
+ PRINTF_ERROR("Reading from block device failed");
+ close(fd2);
+ return -1;
+ }
if ( write(fd2, global_buf, size) != size ) {
PRINTF_ERROR("Dumping image failed");
close(fd2);