- Add upstream patches to support latest libguestfs
f644361b-virCommand-env.patch 2b32735a-virCommand-env.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=233
This commit is contained in:
parent
25374005f5
commit
ae1e5e873b
38
2b32735a-virCommand-env.patch
Normal file
38
2b32735a-virCommand-env.patch
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
commit 2b32735af480055e27400068d27364d521071117
|
||||||
|
Author: Richard W.M. Jones <rjones@redhat.com>
|
||||||
|
Date: Mon Sep 24 17:35:47 2012 +0100
|
||||||
|
|
||||||
|
command: Change virCommandAddEnv so it replaces existing environment variables.
|
||||||
|
|
||||||
|
Index: libvirt-0.10.2/src/util/command.c
|
||||||
|
===================================================================
|
||||||
|
--- libvirt-0.10.2.orig/src/util/command.c
|
||||||
|
+++ libvirt-0.10.2/src/util/command.c
|
||||||
|
@@ -985,11 +985,26 @@ virCommandNonblockingFDs(virCommandPtr c
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add an environment variable to the cmd->env list. 'env' is a
|
||||||
|
- * string like "name=value".
|
||||||
|
+ * string like "name=value". If the named environment variable is
|
||||||
|
+ * already set, then it is replaced in the list.
|
||||||
|
*/
|
||||||
|
static inline void
|
||||||
|
virCommandAddEnv(virCommandPtr cmd, char *env)
|
||||||
|
{
|
||||||
|
+ size_t namelen;
|
||||||
|
+ size_t i;
|
||||||
|
+
|
||||||
|
+ /* Search for the name in the existing environment. */
|
||||||
|
+ namelen = strcspn(env, "=");
|
||||||
|
+ for (i = 0; i < cmd->nenv; ++i) {
|
||||||
|
+ /* + 1 because we want to match the '=' character too. */
|
||||||
|
+ if (STREQLEN(cmd->env[i], env, namelen + 1)) {
|
||||||
|
+ VIR_FREE(cmd->env[i]);
|
||||||
|
+ cmd->env[i] = env;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* Arg plus trailing NULL. */
|
||||||
|
if (VIR_RESIZE_N(cmd->env, cmd->maxenv, cmd->nenv, 1 + 1) < 0) {
|
||||||
|
VIR_FREE(env);
|
88
f644361b-virCommand-env.patch
Normal file
88
f644361b-virCommand-env.patch
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
commit f644361b1eeb78fd59be4cd7ec85567bbf300506
|
||||||
|
Author: Richard W.M. Jones <rjones@redhat.com>
|
||||||
|
Date: Mon Sep 24 17:30:18 2012 +0100
|
||||||
|
|
||||||
|
command: Move environ-adding code to common function virCommandAddEnv.
|
||||||
|
|
||||||
|
This is just code motion. The semantics of the code should be
|
||||||
|
identical after this change.
|
||||||
|
|
||||||
|
Index: libvirt-0.10.2/src/util/command.c
|
||||||
|
===================================================================
|
||||||
|
--- libvirt-0.10.2.orig/src/util/command.c
|
||||||
|
+++ libvirt-0.10.2/src/util/command.c
|
||||||
|
@@ -984,6 +984,22 @@ virCommandNonblockingFDs(virCommandPtr c
|
||||||
|
cmd->flags |= VIR_EXEC_NONBLOCK;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* Add an environment variable to the cmd->env list. 'env' is a
|
||||||
|
+ * string like "name=value".
|
||||||
|
+ */
|
||||||
|
+static inline void
|
||||||
|
+virCommandAddEnv(virCommandPtr cmd, char *env)
|
||||||
|
+{
|
||||||
|
+ /* Arg plus trailing NULL. */
|
||||||
|
+ if (VIR_RESIZE_N(cmd->env, cmd->maxenv, cmd->nenv, 1 + 1) < 0) {
|
||||||
|
+ VIR_FREE(env);
|
||||||
|
+ cmd->has_error = ENOMEM;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ cmd->env[cmd->nenv++] = env;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* virCommandAddEnvFormat:
|
||||||
|
* @cmd: the command to modify
|
||||||
|
@@ -1009,14 +1025,7 @@ virCommandAddEnvFormat(virCommandPtr cmd
|
||||||
|
}
|
||||||
|
va_end(list);
|
||||||
|
|
||||||
|
- /* Arg plus trailing NULL. */
|
||||||
|
- if (VIR_RESIZE_N(cmd->env, cmd->maxenv, cmd->nenv, 1 + 1) < 0) {
|
||||||
|
- VIR_FREE(env);
|
||||||
|
- cmd->has_error = ENOMEM;
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- cmd->env[cmd->nenv++] = env;
|
||||||
|
+ virCommandAddEnv(cmd, env);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@@ -1056,14 +1065,7 @@ virCommandAddEnvString(virCommandPtr cmd
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
- /* env plus trailing NULL */
|
||||||
|
- if (VIR_RESIZE_N(cmd->env, cmd->maxenv, cmd->nenv, 1 + 1) < 0) {
|
||||||
|
- VIR_FREE(env);
|
||||||
|
- cmd->has_error = ENOMEM;
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- cmd->env[cmd->nenv++] = env;
|
||||||
|
+ virCommandAddEnv(cmd, env);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1084,9 +1086,7 @@ virCommandAddEnvBuffer(virCommandPtr cmd
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
- /* env plus trailing NULL. */
|
||||||
|
- if (virBufferError(buf) ||
|
||||||
|
- VIR_RESIZE_N(cmd->env, cmd->maxenv, cmd->nenv, 1 + 1) < 0) {
|
||||||
|
+ if (virBufferError(buf)) {
|
||||||
|
cmd->has_error = ENOMEM;
|
||||||
|
virBufferFreeAndReset(buf);
|
||||||
|
return;
|
||||||
|
@@ -1096,7 +1096,7 @@ virCommandAddEnvBuffer(virCommandPtr cmd
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
- cmd->env[cmd->nenv++] = virBufferContentAndReset(buf);
|
||||||
|
+ virCommandAddEnv(cmd, virBufferContentAndReset(buf));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Oct 11 08:34:36 MDT 2012 - jfehlig@suse.com
|
||||||
|
|
||||||
|
- Add upstream patches to support latest libguestfs
|
||||||
|
f644361b-virCommand-env.patch
|
||||||
|
2b32735a-virCommand-env.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Sep 27 10:35:25 MDT 2012 - jfehlig@suse.com
|
Thu Sep 27 10:35:25 MDT 2012 - jfehlig@suse.com
|
||||||
|
|
||||||
|
@ -413,6 +413,8 @@ Source99: baselibs.conf
|
|||||||
# Upstream patches
|
# Upstream patches
|
||||||
Patch0: 371ddc98-xen-sysctl-9.patch
|
Patch0: 371ddc98-xen-sysctl-9.patch
|
||||||
Patch1: 416eca18-xenstore-header-fix.patch
|
Patch1: 416eca18-xenstore-header-fix.patch
|
||||||
|
Patch2: f644361b-virCommand-env.patch
|
||||||
|
Patch3: 2b32735a-virCommand-env.patch
|
||||||
# Need to go upstream
|
# Need to go upstream
|
||||||
Patch100: xen-name-for-devid.patch
|
Patch100: xen-name-for-devid.patch
|
||||||
Patch101: clone.patch
|
Patch101: clone.patch
|
||||||
@ -550,6 +552,8 @@ Authors:
|
|||||||
%setup -q
|
%setup -q
|
||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
|
%patch2 -p1
|
||||||
|
%patch3 -p1
|
||||||
%patch100 -p1
|
%patch100 -p1
|
||||||
%patch101
|
%patch101
|
||||||
%patch102 -p1
|
%patch102 -p1
|
||||||
|
Loading…
Reference in New Issue
Block a user