This is basically just Jim's patch to refactor the shell escaping API to be usable for plain monitor commands. Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
diff -r 8a19bc8b8fb3 src/qemu_driver.c --- a/src/qemu_driver.c Tue Oct 16 15:34:54 2007 -0400 +++ b/src/qemu_driver.c Tue Oct 16 15:47:33 2007 -0400 @@ -1912,7 +1912,7 @@ static int qemudDomainGetInfo(virDomainP } -static char *qemudEscapeShellArg(const char *in) +static char *qemudEscape(const char *in, int shell) { int len = 0; int i, j; @@ -1934,7 +1934,10 @@ static char *qemudEscapeShellArg(const c len += 2; break; case '\'': - len += 5; + if (shell) + len += 5; + else + len += 1; break; default: len += 1; @@ -1961,11 +1964,15 @@ static char *qemudEscapeShellArg(const c out[j++] = in[i]; break; case '\'': - out[j++] = '\''; - out[j++] = '\\'; - out[j++] = '\\'; - out[j++] = '\''; - out[j++] = '\''; + if (shell) { + out[j++] = '\''; + out[j++] = '\\'; + out[j++] = '\\'; + out[j++] = '\''; + out[j++] = '\''; + } else { + out[j++] = in[i]; + } break; default: out[j++] = in[i]; @@ -1977,6 +1984,10 @@ static char *qemudEscapeShellArg(const c return out; } +static char *qemudEscapeShellArg(const char *in) +{ + return qemudEscape(in, 1); +} #define QEMUD_SAVE_MAGIC "LibvirtQemudSave" #define QEMUD_SAVE_VERSION 1
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list