mirror of
https://github.com/QingdaoU/Judger.git
synced 2024-12-28 16:01:41 +00:00
修复use_nobody=False无效的bug
This commit is contained in:
parent
8ff369c9b1
commit
93dddbc89e
15
judger.c
15
judger.c
@ -99,12 +99,17 @@ static PyObject *judger_run(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
if (!PyBool_Check(use_nobody)) {
|
||||
RaiseValueError("use_nobody must be a bool");
|
||||
}
|
||||
passwd = getpwnam("nobody");
|
||||
if(passwd == NULL) {
|
||||
RaiseValueError("get nobody user info failed");
|
||||
if (PyObject_IsTrue(use_nobody)) {
|
||||
passwd = getpwnam("nobody");
|
||||
if(passwd == NULL) {
|
||||
RaiseValueError("get nobody user info failed");
|
||||
}
|
||||
config.gid = passwd->pw_gid;
|
||||
config.uid = passwd->pw_uid;
|
||||
}
|
||||
else {
|
||||
config.uid = config.gid = -1;
|
||||
}
|
||||
config.gid = passwd->pw_gid;
|
||||
config.uid = passwd->pw_uid;
|
||||
}
|
||||
else {
|
||||
config.uid = config.gid = -1;
|
||||
|
Loading…
Reference in New Issue
Block a user