X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=setns.c;fp=setns.c;h=36aa360bbb803efb6010559cfe710043684f5d06;hb=91f7d4ab476dc6fb2fa5cfeb9a20c6484cc24700;hp=e562cd67f1d07e8b6f0e351997eedf4c79d431d9;hpb=599fef7a8160912979226e6b2ddfdc373aad9fdf;p=lxc-userspace.git diff --git a/setns.c b/setns.c index e562cd6..36aa360 100644 --- a/setns.c +++ b/setns.c @@ -3,6 +3,7 @@ #include #include #include +#include static PyObject * proc_mount(PyObject *self, PyObject *args) @@ -20,7 +21,6 @@ proc_umount(PyObject *self, PyObject *args) sts = umount("/proc"); return Py_BuildValue("i", sts); - } static PyObject * @@ -34,14 +34,15 @@ chfscontext(PyObject *self, PyObject *args) int fd = open(filepath, O_RDONLY); if (fd < 0) { - sts = -1; + sts = -errno; goto out; } if (setns(fd, 0)) { - sts = -1; + sts = -errno; } close(fd); + sts = 0; out: return Py_BuildValue("i", sts); @@ -58,14 +59,15 @@ chcontext(PyObject *self, PyObject *args) int fd = open(filepath, O_RDONLY); if (fd < 0) { - sts = -1; + sts = -errno; goto out; } if (setns(fd, 0)) { - sts = -1; + sts = -errno; } close(fd); + sts = 0; out: return Py_BuildValue("i", sts);