catch fatal i/o errors in add_file_on_disk()
diff --git a/lib/worktree.c b/lib/worktree.c
index e296ce1..e9cc817 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -408,10 +408,10 @@ add_file_on_disk(struct got_worktree *worktree, struct got_fileindex *fileindex,
hdrlen = 0;
if (outlen == -1) {
err = got_error_from_errno();
- break;
+ goto done;
} else if (outlen != len) {
err = got_error(GOT_ERR_IO);
- break;
+ goto done;
}
}
} while (len != 0);