mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
Refactor shell escaping code
This commit is contained in:
parent
eed1b17791
commit
97185033e5
@ -1,3 +1,8 @@
|
|||||||
|
Fri Oct 26 21:17:44 EST 2007 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
|
* src/qemu_driver.c: Refactor shell ecscaping function to reuse
|
||||||
|
for monitor escaping
|
||||||
|
|
||||||
Fri Oct 26 21:14:44 EST 2007 Daniel P. Berrange <berrange@redhat.com>
|
Fri Oct 26 21:14:44 EST 2007 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
* src/qemu_conf.h, src/qemu_conf.c: Refactor device parsing code
|
* src/qemu_conf.h, src/qemu_conf.c: Refactor device parsing code
|
||||||
|
@ -1912,7 +1912,7 @@ static int qemudDomainGetInfo(virDomainPtr dom,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static char *qemudEscapeShellArg(const char *in)
|
static char *qemudEscape(const char *in, int shell)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int i, j;
|
int i, j;
|
||||||
@ -1934,7 +1934,10 @@ static char *qemudEscapeShellArg(const char *in)
|
|||||||
len += 2;
|
len += 2;
|
||||||
break;
|
break;
|
||||||
case '\'':
|
case '\'':
|
||||||
len += 5;
|
if (shell)
|
||||||
|
len += 5;
|
||||||
|
else
|
||||||
|
len += 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
len += 1;
|
len += 1;
|
||||||
@ -1961,11 +1964,15 @@ static char *qemudEscapeShellArg(const char *in)
|
|||||||
out[j++] = in[i];
|
out[j++] = in[i];
|
||||||
break;
|
break;
|
||||||
case '\'':
|
case '\'':
|
||||||
out[j++] = '\'';
|
if (shell) {
|
||||||
out[j++] = '\\';
|
out[j++] = '\'';
|
||||||
out[j++] = '\\';
|
out[j++] = '\\';
|
||||||
out[j++] = '\'';
|
out[j++] = '\\';
|
||||||
out[j++] = '\'';
|
out[j++] = '\'';
|
||||||
|
out[j++] = '\'';
|
||||||
|
} else {
|
||||||
|
out[j++] = in[i];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
out[j++] = in[i];
|
out[j++] = in[i];
|
||||||
@ -1977,6 +1984,10 @@ static char *qemudEscapeShellArg(const char *in)
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *qemudEscapeShellArg(const char *in)
|
||||||
|
{
|
||||||
|
return qemudEscape(in, 1);
|
||||||
|
}
|
||||||
|
|
||||||
#define QEMUD_SAVE_MAGIC "LibvirtQemudSave"
|
#define QEMUD_SAVE_MAGIC "LibvirtQemudSave"
|
||||||
#define QEMUD_SAVE_VERSION 1
|
#define QEMUD_SAVE_VERSION 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user