summaryrefslogtreecommitdiff
path: root/lib/ntdb/open.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-06-18 22:30:27 +0930
committerRusty Russell <rusty@rustcorp.com.au>2012-06-19 05:38:06 +0200
commitf5e9ed1ea965827f29fe0fa77a32e09737e51b45 (patch)
treee8d6d817d775413f29885416b8aecd8e385146d2 /lib/ntdb/open.c
parent16cc345d4f84367e70e133200f7aa335c2aae8c6 (diff)
downloadsamba-f5e9ed1ea965827f29fe0fa77a32e09737e51b45.tar.gz
samba-f5e9ed1ea965827f29fe0fa77a32e09737e51b45.tar.bz2
samba-f5e9ed1ea965827f29fe0fa77a32e09737e51b45.zip
ntdb: remove ntdb_error()
It was a hack to make compatibility easier. Since we're not doing that, it can go away: all callers must use the return value now. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/ntdb/open.c')
-rw-r--r--lib/ntdb/open.c55
1 files changed, 25 insertions, 30 deletions
diff --git a/lib/ntdb/open.c b/lib/ntdb/open.c
index 338de8be8c..28aff0a2ea 100644
--- a/lib/ntdb/open.c
+++ b/lib/ntdb/open.c
@@ -221,34 +221,31 @@ _PUBLIC_ enum NTDB_ERROR ntdb_set_attribute(struct ntdb_context *ntdb,
case NTDB_ATTRIBUTE_HASH:
case NTDB_ATTRIBUTE_SEED:
case NTDB_ATTRIBUTE_OPENHOOK:
- return ntdb->last_error
- = ntdb_logerr(ntdb, NTDB_ERR_EINVAL,
- NTDB_LOG_USE_ERROR,
- "ntdb_set_attribute:"
- " cannot set %s after opening",
- attr->base.attr == NTDB_ATTRIBUTE_HASH
- ? "NTDB_ATTRIBUTE_HASH"
- : attr->base.attr == NTDB_ATTRIBUTE_SEED
- ? "NTDB_ATTRIBUTE_SEED"
- : "NTDB_ATTRIBUTE_OPENHOOK");
+ return ntdb_logerr(ntdb, NTDB_ERR_EINVAL,
+ NTDB_LOG_USE_ERROR,
+ "ntdb_set_attribute:"
+ " cannot set %s after opening",
+ attr->base.attr == NTDB_ATTRIBUTE_HASH
+ ? "NTDB_ATTRIBUTE_HASH"
+ : attr->base.attr == NTDB_ATTRIBUTE_SEED
+ ? "NTDB_ATTRIBUTE_SEED"
+ : "NTDB_ATTRIBUTE_OPENHOOK");
case NTDB_ATTRIBUTE_STATS:
- return ntdb->last_error
- = ntdb_logerr(ntdb, NTDB_ERR_EINVAL,
- NTDB_LOG_USE_ERROR,
- "ntdb_set_attribute:"
- " cannot set NTDB_ATTRIBUTE_STATS");
+ return ntdb_logerr(ntdb, NTDB_ERR_EINVAL,
+ NTDB_LOG_USE_ERROR,
+ "ntdb_set_attribute:"
+ " cannot set NTDB_ATTRIBUTE_STATS");
case NTDB_ATTRIBUTE_FLOCK:
ntdb->lock_fn = attr->flock.lock;
ntdb->unlock_fn = attr->flock.unlock;
ntdb->lock_data = attr->flock.data;
break;
default:
- return ntdb->last_error
- = ntdb_logerr(ntdb, NTDB_ERR_EINVAL,
- NTDB_LOG_USE_ERROR,
- "ntdb_set_attribute:"
- " unknown attribute type %u",
- attr->base.attr);
+ return ntdb_logerr(ntdb, NTDB_ERR_EINVAL,
+ NTDB_LOG_USE_ERROR,
+ "ntdb_set_attribute:"
+ " unknown attribute type %u",
+ attr->base.attr);
}
return NTDB_SUCCESS;
}
@@ -259,7 +256,7 @@ _PUBLIC_ enum NTDB_ERROR ntdb_get_attribute(struct ntdb_context *ntdb,
switch (attr->base.attr) {
case NTDB_ATTRIBUTE_LOG:
if (!ntdb->log_fn)
- return ntdb->last_error = NTDB_ERR_NOEXIST;
+ return NTDB_ERR_NOEXIST;
attr->log.fn = ntdb->log_fn;
attr->log.data = ntdb->log_data;
break;
@@ -272,7 +269,7 @@ _PUBLIC_ enum NTDB_ERROR ntdb_get_attribute(struct ntdb_context *ntdb,
break;
case NTDB_ATTRIBUTE_OPENHOOK:
if (!ntdb->openhook)
- return ntdb->last_error = NTDB_ERR_NOEXIST;
+ return NTDB_ERR_NOEXIST;
attr->openhook.fn = ntdb->openhook;
attr->openhook.data = ntdb->openhook_data;
break;
@@ -289,12 +286,11 @@ _PUBLIC_ enum NTDB_ERROR ntdb_get_attribute(struct ntdb_context *ntdb,
attr->flock.data = ntdb->lock_data;
break;
default:
- return ntdb->last_error
- = ntdb_logerr(ntdb, NTDB_ERR_EINVAL,
- NTDB_LOG_USE_ERROR,
- "ntdb_get_attribute:"
- " unknown attribute type %u",
- attr->base.attr);
+ return ntdb_logerr(ntdb, NTDB_ERR_EINVAL,
+ NTDB_LOG_USE_ERROR,
+ "ntdb_get_attribute:"
+ " unknown attribute type %u",
+ attr->base.attr);
}
attr->base.next = NULL;
return NTDB_SUCCESS;
@@ -415,7 +411,6 @@ _PUBLIC_ struct ntdb_context *ntdb_open(const char *name, int ntdb_flags,
ntdb->flags = ntdb_flags;
ntdb->log_fn = NULL;
ntdb->open_flags = open_flags;
- ntdb->last_error = NTDB_SUCCESS;
ntdb->file = NULL;
ntdb->openhook = NULL;
ntdb->lock_fn = ntdb_fcntl_lock;