diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-12-30 18:01:24 +0100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-12-31 17:33:21 +1100 |
commit | 552e65679df23f488ecee2c0d8555f5e0dad9166 (patch) | |
tree | 462d2773149b482bb7ac0936eadb7e2839508395 /source4 | |
parent | 797977ac53466cb3096d1457e8df087eb7ad7598 (diff) | |
download | samba-552e65679df23f488ecee2c0d8555f5e0dad9166.tar.gz samba-552e65679df23f488ecee2c0d8555f5e0dad9166.tar.bz2 samba-552e65679df23f488ecee2c0d8555f5e0dad9166.zip |
net: Allow Python commands to return None instead of 0.
Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/utils/net/net.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c index ee5cdf8e1c..ba935b9986 100644 --- a/source4/utils/net/net.c +++ b/source4/utils/net/net.c @@ -94,7 +94,14 @@ static int py_call_with_string_args(PyObject *self, const char *method, int argc return 1; } - return PyInt_AsLong(ret); + if (ret == Py_None) { + return 0; + } else if (PyInt_Check(ret)) { + return PyInt_AsLong(ret); + } else { + fprintf(stderr, "Function return value type unexpected.\n"); + return -1; + } } static PyObject *py_commands(void) |