git://git.onelab.eu
/
lxc-userspace.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
599fef7
)
more meaningful retcods for ch[fs]context
author
Thierry Parmentelat
<thierry.parmentelat@inria.fr>
Wed, 15 Jan 2014 10:35:58 +0000
(11:35 +0100)
committer
Thierry Parmentelat
<thierry.parmentelat@inria.fr>
Wed, 15 Jan 2014 10:35:58 +0000
(11:35 +0100)
setns.c
patch
|
blob
|
history
diff --git
a/setns.c
b/setns.c
index
e562cd6
..
36aa360
100644
(file)
--- a/
setns.c
+++ b/
setns.c
@@
-3,6
+3,7
@@
#include <stdio.h>
#include <asm/unistd.h>
#include <sys/mount.h>
#include <stdio.h>
#include <asm/unistd.h>
#include <sys/mount.h>
+#include <errno.h>
static PyObject *
proc_mount(PyObject *self, PyObject *args)
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);
sts = umount("/proc");
return Py_BuildValue("i", sts);
-
}
static PyObject *
}
static PyObject *
@@
-34,14
+34,15
@@
chfscontext(PyObject *self, PyObject *args)
int fd = open(filepath, O_RDONLY);
if (fd < 0) {
int fd = open(filepath, O_RDONLY);
if (fd < 0) {
- sts = -
1
;
+ sts = -
errno
;
goto out;
}
if (setns(fd, 0)) {
goto out;
}
if (setns(fd, 0)) {
- sts = -
1
;
+ sts = -
errno
;
}
close(fd);
}
close(fd);
+ sts = 0;
out:
return Py_BuildValue("i", sts);
out:
return Py_BuildValue("i", sts);
@@
-58,14
+59,15
@@
chcontext(PyObject *self, PyObject *args)
int fd = open(filepath, O_RDONLY);
if (fd < 0) {
int fd = open(filepath, O_RDONLY);
if (fd < 0) {
- sts = -
1
;
+ sts = -
errno
;
goto out;
}
if (setns(fd, 0)) {
goto out;
}
if (setns(fd, 0)) {
- sts = -
1
;
+ sts = -
errno
;
}
close(fd);
}
close(fd);
+ sts = 0;
out:
return Py_BuildValue("i", sts);
out:
return Py_BuildValue("i", sts);