summaryrefslogtreecommitdiff
path: root/source4/build/pidl/swig.pm
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build/pidl/swig.pm')
-rw-r--r--source4/build/pidl/swig.pm21
1 files changed, 19 insertions, 2 deletions
diff --git a/source4/build/pidl/swig.pm b/source4/build/pidl/swig.pm
index 3694cfdec9..cdfe90450d 100644
--- a/source4/build/pidl/swig.pm
+++ b/source4/build/pidl/swig.pm
@@ -346,9 +346,26 @@ sub ParseFunction($)
} else {
$result .= "\tPyDict_SetItemString(temp, \"result\", PyLong_FromLong(W_ERROR_V(arg3->out.result)));\n";
}
- $result .= "\tresultobj = temp;\n";
- $result .= "\ttalloc_free(mem_ctx);\n";
+ $result .= "\n";
+
+ $result .= "\tresultobj = temp;\n\n";
+
+
+
+ $result .= "\tif (NT_STATUS_IS_ERR(result)) {\n";
+ $result .= "\t\tset_ntstatus_exception(NT_STATUS_V(result));\n";
+ $result .= "\t\tgoto fail;\n";
+ $result .= "\t}\n";
+
+ if (!($fn->{RETURN_TYPE} eq "NTSTATUS")) {
+ $result .= "\tif (!W_ERROR_IS_OK(arg3->out.result) && \n";
+ $result .= "\t\t!(W_ERROR_EQUAL(arg3->out.result, WERR_INSUFFICIENT_BUFFER))) {\n";
+ $result .= "\t\tset_werror_exception(W_ERROR_V(arg3->out.result));\n";
+ $result .= "\t\tgoto fail;\n";
+ $result .= "\t}\n";
+ }
+
$result .= "}\n\n";
# Function definitions