From 9c80adb5a14b8980bbb85d54c4a5bdbfecdd86bc Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Fri, 12 Sep 2014 11:50:22 -0400 Subject: [PATCH] VBOX: Initialize completion file values before parsing. --- samples/vboxwrapper/vboxwrapper.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/samples/vboxwrapper/vboxwrapper.cpp b/samples/vboxwrapper/vboxwrapper.cpp index a9e368004d..e05fc696f5 100644 --- a/samples/vboxwrapper/vboxwrapper.cpp +++ b/samples/vboxwrapper/vboxwrapper.cpp @@ -411,10 +411,12 @@ void extract_completion_file_info(VBOX_VM& vm, unsigned long& exit_code, string& char path[MAXPATHLEN]; char buf[1024]; + exit_code = 0; + message = ""; + sprintf(path, "shared/%s", vm.completion_trigger_file.c_str()); FILE* f = fopen(path, "r"); if (f) { - message = ""; if (fgets(buf, 1024, f) != NULL) { exit_code = atoi(buf); }