mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
Raise proper exceptions when lp file can't be found, be a
bit less strict when no file was specified.
This commit is contained in:
parent
1807b0870b
commit
84501f6b59
@ -317,6 +317,8 @@ struct loadparm_context *lp_from_py_object(PyObject *py_obj)
|
||||
lp_ctx = loadparm_init(NULL);
|
||||
if (!lp_load(lp_ctx, PyString_AsString(py_obj))) {
|
||||
talloc_free(lp_ctx);
|
||||
PyErr_Format(PyExc_RuntimeError,
|
||||
"Unable to load %s", PyString_AsString(py_obj));
|
||||
return NULL;
|
||||
}
|
||||
return lp_ctx;
|
||||
@ -324,10 +326,8 @@ struct loadparm_context *lp_from_py_object(PyObject *py_obj)
|
||||
|
||||
if (py_obj == Py_None) {
|
||||
lp_ctx = loadparm_init(NULL);
|
||||
if (!lp_load_default(lp_ctx)) {
|
||||
talloc_free(lp_ctx);
|
||||
return NULL;
|
||||
}
|
||||
/* We're not checking that loading the file succeeded *on purpose */
|
||||
lp_load_default(lp_ctx);
|
||||
return lp_ctx;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user