summaryrefslogtreecommitdiff
path: root/source4/scripting/swig
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2005-05-03 07:10:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:16:29 -0500
commit17f1cf095022a88541c461f2ea66940daabcd9a8 (patch)
treeff4e098e72d0677ae50c0d3c77ad73b8adef93a9 /source4/scripting/swig
parentc8d0e36312e351f0aba2e71d7744397d9fa11961 (diff)
downloadsamba-17f1cf095022a88541c461f2ea66940daabcd9a8.tar.gz
samba-17f1cf095022a88541c461f2ea66940daabcd9a8.tar.bz2
samba-17f1cf095022a88541c461f2ea66940daabcd9a8.zip
r6592: Throw an IOError exception if tdb_open() or tdb_open_Ex() returns NULL.
(This used to be commit 99fb6b6badf1afeac21fdb5f1ce04c1749e1b7f7)
Diffstat (limited to 'source4/scripting/swig')
-rw-r--r--source4/scripting/swig/tdb.i12
1 files changed, 12 insertions, 0 deletions
diff --git a/source4/scripting/swig/tdb.i b/source4/scripting/swig/tdb.i
index b381487ebc..6c6c4af8cd 100644
--- a/source4/scripting/swig/tdb.i
+++ b/source4/scripting/swig/tdb.i
@@ -103,6 +103,16 @@ typedef int mode_t;
#define TDB_CONVERT 16 /* convert endian (internal use) */
#define TDB_BIGENDIAN 32 /* header is big-endian (internal use) */
+/* Throw an IOError exception if tdb_open() or tdb_open_ex() returns NULL */
+
+%exception {
+ $action
+ if (result == NULL) {
+ PyErr_SetFromErrno(PyExc_IOError);
+ SWIG_fail;
+ }
+}
+
%rename tdb_open open;
TDB_CONTEXT *tdb_open(const char *name, int hash_size, int tdb_flags,
int open_flags, mode_t mode);
@@ -113,6 +123,8 @@ TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
tdb_log_func log_fn,
tdb_hash_func hash_fn);
+%exception;
+
%rename tdb_reopen reopen;
int tdb_reopen(TDB_CONTEXT *tdb);