mirror of https://github.com/BOINC/boinc.git
VBOX: Bug fix from Christian Beer.
This commit is contained in:
parent
00e0e16178
commit
d62133047a
|
@ -30,6 +30,7 @@
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <sys/io.h>
|
#include <sys/io.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -43,9 +44,6 @@ void guestlog(int c)
|
||||||
int main() {
|
int main() {
|
||||||
std::string buffer;
|
std::string buffer;
|
||||||
|
|
||||||
// Dump input stream to string buffer
|
|
||||||
std::cin >> buffer;
|
|
||||||
|
|
||||||
// root access required
|
// root access required
|
||||||
if (iopl(3)) {
|
if (iopl(3)) {
|
||||||
if (EPERM == errno) {
|
if (EPERM == errno) {
|
||||||
|
@ -55,19 +53,23 @@ int main() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write output to stdout as well as VirtualBox's Guest VM Log
|
while (getline(std::cin,buffer)) {
|
||||||
for (size_t i = 0; i < buffer.size(); ++i) {
|
|
||||||
// Virtualbox
|
// Write output to stdout as well as VirtualBox's Guest VM Log
|
||||||
guestlog((int)buffer[i]);
|
for (size_t i = 0; i < buffer.size(); ++i) {
|
||||||
|
// Virtualbox
|
||||||
|
guestlog((int)buffer[i]);
|
||||||
|
|
||||||
|
// Console
|
||||||
|
putc((int)buffer[i], stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force newlines so that the text looks good on the console and causes
|
||||||
|
// the guest additions to actually log the data
|
||||||
|
guestlog('\n');
|
||||||
|
putc('\n', stdout);
|
||||||
|
|
||||||
// Console
|
|
||||||
putc((int)buffer[i], stdout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force newlines so that the text looks good on the console and causes
|
|
||||||
// the guest additions to actually log the data
|
|
||||||
guestlog('\n');
|
|
||||||
putc('\n', stdout);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue