ctdb-tests: nfs_iterate_test() marks RPC service down
[samba4-gss.git] / lib / tdb / common / error.c
blobc3ef8bd14384dbadd9cd968557a38c7b7db93ecf
1 /*
2 Unix SMB/CIFS implementation.
4 trivial database library
6 Copyright (C) Andrew Tridgell 1999-2005
7 Copyright (C) Paul `Rusty' Russell 2000
8 Copyright (C) Jeremy Allison 2000-2003
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
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.
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.
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/>.
28 #include "tdb_private.h"
30 _PUBLIC_ enum TDB_ERROR tdb_error(struct tdb_context *tdb)
32 return tdb->ecode;
35 _PUBLIC_ const char *tdb_errorstr(struct tdb_context *tdb)
37 switch (tdb->ecode) {
38 case TDB_SUCCESS:
39 return "Success";
40 break;
41 case TDB_ERR_CORRUPT:
42 return "Corrupt database";
43 break;
44 case TDB_ERR_IO:
45 return "IO Error";
46 break;
47 case TDB_ERR_LOCK:
48 return "Locking error";
49 break;
50 case TDB_ERR_OOM:
51 return "Out of memory";
52 break;
53 case TDB_ERR_EXISTS:
54 return "Record exists";
55 break;
56 case TDB_ERR_NOLOCK:
57 return "Lock exists on other keys";
58 break;
59 case TDB_ERR_EINVAL:
60 return "Invalid parameter";
61 break;
62 case TDB_ERR_NOEXIST:
63 return "Record does not exist";
64 break;
65 case TDB_ERR_RDONLY:
66 return "write not permitted";
67 break;
68 default:
69 break;
72 return "Invalid error code";