Line data Source code
1 : /* 2 : Unix SMB/CIFS implementation. 3 : 4 : trivial database library 5 : 6 : Copyright (C) Andrew Tridgell 1999-2005 7 : Copyright (C) Paul `Rusty' Russell 2000 8 : Copyright (C) Jeremy Allison 2000-2003 9 : 10 : ** NOTE! The following LGPL license applies to the tdb 11 : ** library. This does NOT imply that all of Samba is released 12 : ** under the LGPL 13 : 14 : This library is free software; you can redistribute it and/or 15 : modify it under the terms of the GNU Lesser General Public 16 : License as published by the Free Software Foundation; either 17 : version 3 of the License, or (at your option) any later version. 18 : 19 : This library is distributed in the hope that it will be useful, 20 : but WITHOUT ANY WARRANTY; without even the implied warranty of 21 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 : Lesser General Public License for more details. 23 : 24 : You should have received a copy of the GNU Lesser General Public 25 : License along with this library; if not, see <http://www.gnu.org/licenses/>. 26 : */ 27 : 28 : #include "tdb_private.h" 29 : 30 134667799 : _PUBLIC_ enum TDB_ERROR tdb_error(struct tdb_context *tdb) 31 : { 32 134667799 : return tdb->ecode; 33 : } 34 : 35 211 : _PUBLIC_ const char *tdb_errorstr(struct tdb_context *tdb) 36 : { 37 211 : switch (tdb->ecode) { 38 0 : case TDB_SUCCESS: 39 0 : return "Success"; 40 0 : break; 41 0 : case TDB_ERR_CORRUPT: 42 0 : return "Corrupt database"; 43 0 : break; 44 0 : case TDB_ERR_IO: 45 0 : return "IO Error"; 46 0 : break; 47 2 : case TDB_ERR_LOCK: 48 2 : return "Locking error"; 49 0 : break; 50 0 : case TDB_ERR_OOM: 51 0 : return "Out of memory"; 52 0 : break; 53 0 : case TDB_ERR_EXISTS: 54 0 : return "Record exists"; 55 0 : break; 56 0 : case TDB_ERR_NOLOCK: 57 0 : return "Lock exists on other keys"; 58 0 : break; 59 0 : case TDB_ERR_EINVAL: 60 0 : return "Invalid parameter"; 61 24 : break; 62 209 : case TDB_ERR_NOEXIST: 63 209 : return "Record does not exist"; 64 0 : break; 65 0 : case TDB_ERR_RDONLY: 66 0 : return "write not permitted"; 67 0 : break; 68 0 : default: 69 0 : break; 70 : } 71 : 72 0 : return "Invalid error code"; 73 : } 74 :