guest agent: fix for guest agent RPCs/commands

Message ID
State New
Headers show

Commit Message

Michael Roth June 15, 2011, 12:13 a.m.
One of my commits must've gotten lost while I was squashing patches. 
Please apply the attached patch to correct a build issue due to 
qmp_guest_file_open()'s implementation not matching the qapi-generated 
prototype. Patch 3 has been updated in the corresponding repo branch if 
you're pulling from there.

Thanks to Matsuda Daiki for catching this.

Signed-off-by: Michael Roth <>
      FILE *fh;
      int fd, ret;
@@ -179,6 +179,9 @@ int64_t qmp_guest_file_open(const char *filepath, 
const char *mode, Error **err)
          error_set(err, QERR_QGA_LOGGING_FAILED);
          goto out;
+    if (!has_mode) {
+        mode = "r";
+    }
      slog("guest-file-open called, filepath: %s, mode: %s", filepath, 
      fh = fopen(filepath, mode);
      if (!fh) {


diff --git a/qga/guest-agent-commands.c b/qga/guest-agent-commands.c
index 6f9886a..dbdc3b7 100644
--- a/qga/guest-agent-commands.c
+++ b/qga/guest-agent-commands.c
@@ -169,7 +169,7 @@  static void guest_file_handle_remove(int64_t id)

-int64_t qmp_guest_file_open(const char *filepath, const char *mode, 
Error **err)
+int64_t qmp_guest_file_open(const char *filepath, bool has_mode, const 
char *mode, Error **err)