mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
lxcContainerMountFSDevPTS: Unify @ret usage pattern
Currently, if virFileMakePath() fails, the @ret is left initialized from virAsprintf() just a few lines above leading to a wrong return value of zero whereas -1 should be returned. Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
036aeca721
commit
78d04e556a
@ -940,16 +940,14 @@ cleanup:
|
|||||||
static int lxcContainerMountFSDevPTS(virDomainDefPtr def,
|
static int lxcContainerMountFSDevPTS(virDomainDefPtr def,
|
||||||
const char *stateDir)
|
const char *stateDir)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = -1;
|
||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
int flags = def->idmap.nuidmap ? MS_BIND : MS_MOVE;
|
int flags = def->idmap.nuidmap ? MS_BIND : MS_MOVE;
|
||||||
|
|
||||||
VIR_DEBUG("Mount /dev/pts stateDir=%s", stateDir);
|
VIR_DEBUG("Mount /dev/pts stateDir=%s", stateDir);
|
||||||
|
|
||||||
if ((ret = virAsprintf(&path,
|
if (virAsprintf(&path, "/.oldroot/%s/%s.devpts",
|
||||||
"/.oldroot/%s/%s.devpts",
|
stateDir, def->name) < 0)
|
||||||
stateDir,
|
|
||||||
def->name)) < 0)
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (virFileMakePath("/dev/pts") < 0) {
|
if (virFileMakePath("/dev/pts") < 0) {
|
||||||
@ -961,16 +959,16 @@ static int lxcContainerMountFSDevPTS(virDomainDefPtr def,
|
|||||||
VIR_DEBUG("Trying to %s %s to /dev/pts", def->idmap.nuidmap ?
|
VIR_DEBUG("Trying to %s %s to /dev/pts", def->idmap.nuidmap ?
|
||||||
"bind" : "move", path);
|
"bind" : "move", path);
|
||||||
|
|
||||||
if ((ret = mount(path, "/dev/pts", NULL, flags, NULL)) < 0) {
|
if (mount(path, "/dev/pts", NULL, flags, NULL) < 0) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("Failed to mount %s on /dev/pts"),
|
_("Failed to mount %s on /dev/pts"),
|
||||||
path);
|
path);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(path);
|
VIR_FREE(path);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user