Commit 4c200d12 by Michel Normand Committed by Daniel Lezcano

report error in lxc_get_lock

report error in lxc_get_lock and remove the call to lxc_strerror that become useless for these errors. Signed-off-by: 's avatarMichel Normand <normand@fr.ibm.com> Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 305dbab7
......@@ -70,23 +70,24 @@ int lxc_get_lock(const char *name)
ret = __lxc_get_lock(name);
if (ret < 0)
goto out_err;
out:
return ret;
out_err:
switch (-ret) {
case EWOULDBLOCK:
ret = -LXC_ERROR_EBUSY;
goto out;
ERROR("container '%s' is busy", name);
break;
case ENOENT:
ret = -LXC_ERROR_ENOENT;
goto out;
ERROR("container '%s' is not found", name);
break;
case EACCES:
ret = -LXC_ERROR_EACCES;
goto out;
ERROR("not enough privilege to use container '%s'", name);
break;
default:
ret = -LXC_ERROR_LOCK;
goto out;
ERROR("container '%s' failed to lock : %s",
name, strerror(-ret));
}
return -1;
}
int lxc_check_lock(const char *name)
......
......@@ -100,7 +100,7 @@ int main(int argc, char *argv[])
/* lxc-init --mount-procfs -- .... */
args = malloc((argc + 3)*sizeof(*args));
if (!args) {
ERROR("failed to allocate memory for '%s'\n", name);
ERROR("failed to allocate memory for '%s'", name);
goto out;
}
......@@ -114,8 +114,7 @@ int main(int argc, char *argv[])
ret = lxc_start(name, args);
if (ret) {
ERROR("failed to start '%s': %s\n", name,
lxc_strerror(ret));
ERROR("failed to start '%s'", name);
goto out;
}
......@@ -123,8 +122,7 @@ int main(int argc, char *argv[])
out:
if (autodestroy) {
if (lxc_destroy(name)) {
ERROR("failed to destroy '%s': %s\n",
name, lxc_strerror(ret));
ERROR("failed to destroy '%s'", name);
ret = 1;
}
}
......
......@@ -98,7 +98,7 @@ int main(int argc, char *argv[])
err = lxc_start(name, args);
if (err) {
ERROR("failed to start : %s\n", lxc_strerror(err));
ERROR("failed to start '%s'", name);
err = 1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment