diff options
author | Simo Sorce <idra@samba.org> | 2006-08-27 23:32:14 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:16:49 -0500 |
commit | d0ef5aad1747974608138056132f4c4a515081cd (patch) | |
tree | 57fc14c579597bc1bcb9a062879a1405043afd62 /source4/lib/ldb | |
parent | 8856986214aec9fc794d2575c9f2e2454aa3989a (diff) | |
download | samba-d0ef5aad1747974608138056132f4c4a515081cd.tar.gz samba-d0ef5aad1747974608138056132f4c4a515081cd.tar.bz2 samba-d0ef5aad1747974608138056132f4c4a515081cd.zip |
r17859: Fix some return values
(This used to be commit 5b4fc48c49bada2711e356c557ba5f45e34396f6)
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r-- | source4/lib/ldb/common/ldb_msg.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c index b42c4fe602..52c6b82484 100644 --- a/source4/lib/ldb/common/ldb_msg.c +++ b/source4/lib/ldb/common/ldb_msg.c @@ -124,14 +124,14 @@ int ldb_msg_add_empty(struct ldb_message *msg, const char *attr_name, int flags) struct ldb_message_element *els; if (! ldb_valid_attr_name(attr_name)) { - return -1; + return LDB_ERR_OPERATIONS_ERROR; } els = talloc_realloc(msg, msg->elements, struct ldb_message_element, msg->num_elements+1); if (!els) { errno = ENOMEM; - return -1; + return LDB_ERR_OPERATIONS_ERROR; } els[msg->num_elements].values = NULL; @@ -140,13 +140,13 @@ int ldb_msg_add_empty(struct ldb_message *msg, const char *attr_name, int flags) els[msg->num_elements].name = talloc_strdup(els, attr_name); if (!els[msg->num_elements].name) { errno = ENOMEM; - return -1; + return LDB_ERR_OPERATIONS_ERROR; } msg->elements = els; msg->num_elements++; - return 0; + return LDB_SUCCESS; } /* @@ -157,13 +157,13 @@ int ldb_msg_add(struct ldb_message *msg, int flags) { if (ldb_msg_add_empty(msg, el->name, flags) != 0) { - return -1; + return LDB_ERR_OPERATIONS_ERROR; } msg->elements[msg->num_elements-1] = *el; msg->elements[msg->num_elements-1].flags = flags; - return 0; + return LDB_SUCCESS; } /* @@ -182,19 +182,19 @@ int ldb_msg_add_value(struct ldb_message *msg, el = ldb_msg_find_element(msg, attr_name); } if (!el) { - return -1; + return LDB_ERR_OPERATIONS_ERROR; } vals = talloc_realloc(msg, el->values, struct ldb_val, el->num_values+1); if (!vals) { errno = ENOMEM; - return -1; + return LDB_ERR_OPERATIONS_ERROR; } el->values = vals; el->values[el->num_values] = *val; el->num_values++; - return 0; + return LDB_SUCCESS; } @@ -258,7 +258,7 @@ int ldb_msg_add_fmt(struct ldb_message *msg, str = talloc_vasprintf(msg, fmt, ap); va_end(ap); - if (str == NULL) return -1; + if (str == NULL) return LDB_ERR_OPERATIONS_ERROR; val.data = (uint8_t *)str; val.length = strlen(str); @@ -684,13 +684,13 @@ int ldb_msg_rename_attr(struct ldb_message *msg, const char *attr, const char *r { struct ldb_message_element *el = ldb_msg_find_element(msg, attr); if (el == NULL) { - return 0; + return LDB_SUCCESS; } el->name = talloc_strdup(msg->elements, replace); if (el->name == NULL) { - return -1; + return LDB_ERR_OPERATIONS_ERROR; } - return 0; + return LDB_SUCCESS; } @@ -701,10 +701,10 @@ int ldb_msg_copy_attr(struct ldb_message *msg, const char *attr, const char *rep { struct ldb_message_element *el = ldb_msg_find_element(msg, attr); if (el == NULL) { - return 0; + return LDB_SUCCESS; } if (ldb_msg_add(msg, el, 0) != 0) { - return -1; + return LDB_ERR_OPERATIONS_ERROR; } return ldb_msg_rename_attr(msg, attr, replace); } |