ntfsclone: fix restore from stdin

When doing a ntfclone-restore from stdin and stdin is then closed,
ntfsclone will loop forever:
$ cat corrupt_image.gz | gzip -d | ntfsclone -r -O somedisk -

With this patch the io_all() loop will return an error when the
input-stream is closed.
edge.strict_endians
Olaf Rempel 2009-03-23 17:21:17 +01:00 committed by Yura Pakhuchiy
parent d6c0cc5786
commit 48f652e0e1
1 changed files with 2 additions and 0 deletions

View File

@ -529,6 +529,8 @@ static int io_all(void *fd, void *buf, int count, int do_write)
if (i < 0) {
if (errno != EAGAIN && errno != EINTR)
return -1;
} else if (i == 0 && !do_write && opt.restore_image) {
return -1;
} else {
count -= i;
buf = i + (char *) buf;