Reviewed-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
-----Original Message-----
From: libvir-list-bounces(a)redhat.com
[mailto:libvir-list-bounces@redhat.com]
On Behalf Of Daniel P. Berrange
Sent: Monday, October 07, 2013 9:07 PM
To: libvir-list(a)redhat.com
Subject: [libvirt] [PATCH 3/6] Remove pointless 'srcpath' variable in
lxcContainerMountBasicFS
From: "Daniel P. Berrange" <berrange(a)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(a)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
--
libvir-list mailing list
libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list