fprintf (stderr, "closing guestfs handle %p (state %d)\n", g, g->state);
/* Try to sync if autosync flag is set. */
fprintf (stderr, "closing guestfs handle %p (state %d)\n", g, g->state);
/* Try to sync if autosync flag is set. */
- int r, i, len, pmore, memsize;
+ int r, i, pmore, memsize;
+ size_t len;
- add_cmdline (g, "nic,model=rtl8139,vlan=0");
+ add_cmdline (g, "nic,model=virtio,vlan=0");
- while (!cancel && (r = read (fd, buf, sizeof buf)) > 0) {
+ while (!cancel) {
+ r = read (fd, buf, sizeof buf);
+ if (r == -1 && (errno == EINTR || errno == EAGAIN))
+ continue;
+ if (r <= 0) break;
err = send_file_data_sync (g, buf, r);
if (err < 0) {
if (err == -2) /* daemon sent cancellation */
err = send_file_data_sync (g, buf, r);
if (err < 0) {
if (err == -2) /* daemon sent cancellation */
static int
send_file_chunk_sync (guestfs_h *g, int cancel, const char *buf, size_t buflen)
{
static int
send_file_chunk_sync (guestfs_h *g, int cancel, const char *buf, size_t buflen)
{
/* Synchronously receive a file. */
/* Returns -1 = error, 0 = EOF, 1 = more data */
/* Synchronously receive a file. */
/* Returns -1 = error, 0 = EOF, 1 = more data */
/* Receive a chunk of file data. */
/* Returns -1 = error, 0 = EOF, 1 = more data */
static int
/* Receive a chunk of file data. */
/* Returns -1 = error, 0 = EOF, 1 = more data */
static int