Code Review
/
kvmfornfv.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "[fuel-plugin] Employ dedicated reboot task"
[kvmfornfv.git]
/
qemu
/
qga
/
channel-posix.c
diff --git
a/qemu/qga/channel-posix.c
b/qemu/qga/channel-posix.c
index
8aad4fe
..
63458c6
100644
(file)
--- a/
qemu/qga/channel-posix.c
+++ b/
qemu/qga/channel-posix.c
@@
-1,11
+1,7
@@
+#include "qemu/osdep.h"
#include <glib.h>
#include <termios.h>
#include <glib.h>
#include <termios.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include "qemu/osdep.h"
+#include "qapi/error.h"
#include "qemu/sockets.h"
#include "qga/channel.h"
#include "qemu/sockets.h"
#include "qga/channel.h"
@@
-217,25
+213,24
@@
GIOStatus ga_channel_write_all(GAChannel *c, const gchar *buf, gsize size)
GIOStatus status = G_IO_STATUS_NORMAL;
while (size) {
GIOStatus status = G_IO_STATUS_NORMAL;
while (size) {
+ g_debug("sending data, count: %d", (int)size);
status = g_io_channel_write_chars(c->client_channel, buf, size,
&written, &err);
status = g_io_channel_write_chars(c->client_channel, buf, size,
&written, &err);
- g_debug("sending data, count: %d", (int)size);
- if (err != NULL) {
+ if (status == G_IO_STATUS_NORMAL) {
+ size -= written;
+ buf += written;
+ } else if (status != G_IO_STATUS_AGAIN) {
g_warning("error writing to channel: %s", err->message);
g_warning("error writing to channel: %s", err->message);
- return
G_IO_STATUS_ERROR
;
+ return
status
;
}
}
- if (status != G_IO_STATUS_NORMAL) {
- break;
- }
- size -= written;
}
}
-
if (status == G_IO_STATUS_NORMAL)
{
+
do
{
status = g_io_channel_flush(c->client_channel, &err);
status = g_io_channel_flush(c->client_channel, &err);
- if (err != NULL) {
- g_warning("error flushing channel: %s", err->message);
- return G_IO_STATUS_ERROR;
- }
+ } while (status == G_IO_STATUS_AGAIN);
+
+ if (status != G_IO_STATUS_NORMAL) {
+ g_warning("error flushing channel: %s", err->message);
}
return status;
}
return status;
@@
-249,7
+244,7
@@
GIOStatus ga_channel_read(GAChannel *c, gchar *buf, gsize size, gsize *count)
GAChannel *ga_channel_new(GAChannelMethod method, const gchar *path,
GAChannelCallback cb, gpointer opaque)
{
GAChannel *ga_channel_new(GAChannelMethod method, const gchar *path,
GAChannelCallback cb, gpointer opaque)
{
- GAChannel *c = g_
malloc0(sizeof(GAChannel)
);
+ GAChannel *c = g_
new0(GAChannel, 1
);
c->event_cb = cb;
c->user_data = opaque;
c->event_cb = cb;
c->user_data = opaque;