summaryrefslogtreecommitdiffstats
path: root/recipes-extended/libvirt/libvirt/0003-Remove-pointless-srcpath-variable-in-lxcContainerMountBasicFS.patch
blob: 5135fb015b48c28223c5417945a6d576ecd892e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
From: "Daniel P. Berrange" <berrange@redhat.com>
To: libvir-list@redhat.com
Date: Mon,  7 Oct 2013 14:06:48 +0100
Message-Id: <1381151211-27111-4-git-send-email-berrange@redhat.com>
In-Reply-To: <1381151211-27111-1-git-send-email-berrange@redhat.com>
References: <1381151211-27111-1-git-send-email-berrange@redhat.com>
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 3/6] Remove pointless 'srcpath' variable in
	lxcContainerMountBasicFS
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
	<libvir-list.redhat.com>
List-Unsubscribe: <https://www.redhat.com/mailman/options/libvir-list>,
	<mailto:libvir-list-request@redhat.com?subject=unsubscribe>
List-Archive: <https://www.redhat.com/archives/libvir-list>
List-Post: <mailto:libvir-list@redhat.com>
List-Help: <mailto:libvir-list-request@redhat.com?subject=help>
List-Subscribe: <https://www.redhat.com/mailman/listinfo/libvir-list>,
	<mailto:libvir-list-request@redhat.com?subject=subscribe>
X-List-Received-Date: Mon, 07 Oct 2013 13:06:59 -0000

From: "Daniel P. Berrange" <berrange@redhat.com>

The 'srcpath' variable is initialized from 'mnt->src' and never
changed thereafter. Some places continue to use 'mnt->src' and
others use 'srcpath'. Remove the pointless 'srcpath' variable
and use 'mnt->src' everywhere.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 src/lxc/lxc_container.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 3c89ed7..1b1c93b 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -853,16 +853,13 @@ static int lxcContainerMountBasicFS(bool userns_enabled)
 
     for (i = 0; i < ARRAY_CARDINALITY(lxcBasicMounts); i++) {
         virLXCBasicMountInfo const *mnt = &lxcBasicMounts[i];
-        const char *srcpath = NULL;
 
         VIR_DEBUG("Processing %s -> %s",
                   mnt->src, mnt->dst);
 
-        srcpath = mnt->src;
-
         /* Skip if mount doesn't exist in source */
-        if ((srcpath[0] == '/') &&
-            (access(srcpath, R_OK) < 0))
+        if ((mnt->src[0] == '/') &&
+            (access(mnt->src, R_OK) < 0))
             continue;
 
 #if WITH_SELINUX
@@ -882,11 +879,11 @@ static int lxcContainerMountBasicFS(bool userns_enabled)
         }
 
         VIR_DEBUG("Mount %s on %s type=%s flags=%x",
-                  srcpath, mnt->dst, mnt->type, mnt->mflags);
-        if (mount(srcpath, mnt->dst, mnt->type, mnt->mflags, NULL) < 0) {
+                  mnt->src, mnt->dst, mnt->type, mnt->mflags);
+        if (mount(mnt->src, mnt->dst, mnt->type, mnt->mflags, NULL) < 0) {
             virReportSystemError(errno,
                                  _("Failed to mount %s on %s type %s flags=%x"),
-                                 srcpath, mnt->dst, NULLSTR(mnt->type),
+                                 mnt->src, mnt->dst, NULLSTR(mnt->type),
                                  mnt->mflags);
             goto cleanup;
         }
-- 
1.8.3.1