diff options
author | Martin Hedenfal <martinh@cvs.openbsd.org> | 2010-07-06 09:27:06 +0000 |
---|---|---|
committer | Martin Hedenfal <martinh@cvs.openbsd.org> | 2010-07-06 09:27:06 +0000 |
commit | 0d8faa856c504fe33184febbb2d003197e5916b6 (patch) | |
tree | 51219510d6cc0103d843c24a70e1042f74870914 /usr.sbin | |
parent | 6a5abb5090475ac195b2efb17a024a2204c6e8b8 (diff) |
Check return code from commit. Incorrectly returned success when commit
failed due to disk full.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ldapd/modify.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/usr.sbin/ldapd/modify.c b/usr.sbin/ldapd/modify.c index cb4ee024349..fd442c494a8 100644 --- a/usr.sbin/ldapd/modify.c +++ b/usr.sbin/ldapd/modify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: modify.c,v 1.10 2010/07/05 14:27:06 martinh Exp $ */ +/* $OpenBSD: modify.c,v 1.11 2010/07/06 09:27:05 martinh Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se> @@ -89,10 +89,8 @@ ldap_delete(struct request *req) goto done; } - if (namespace_del(ns, dn) == 0) { - namespace_commit(ns); + if (namespace_del(ns, dn) == 0 && namespace_commit(ns) == 0) rc = LDAP_SUCCESS; - } done: btree_cursor_close(cursor); @@ -212,7 +210,7 @@ fail: int ldap_modify(struct request *req) { - int rc; + int rc = LDAP_OTHER; char *dn; long long op; char *attr; @@ -323,19 +321,13 @@ ldap_modify(struct request *req) else ldap_add_attribute(entry, "modifyTimestamp", set); - if (namespace_update(ns, dn, entry) == 0) + if (namespace_update(ns, dn, entry) == 0 && namespace_commit(ns) == 0) rc = LDAP_SUCCESS; else rc = LDAP_OTHER; done: - if (rc == LDAP_SUCCESS) - namespace_commit(ns); - else - namespace_abort(ns); - - if (rc >= 0) - ldap_respond(req, rc); - return rc; + namespace_abort(ns); + return ldap_respond(req, rc); } |