summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb_selinux.c
diff options
context:
space:
mode:
authorMichal Zidek <mzidek@redhat.com>2012-08-15 10:56:21 +0200
committerJakub Hrozek <jhrozek@redhat.com>2012-09-04 13:56:32 +0200
commit3a59cbd0b7b9c5dd3c62ac1679876070c264d80f (patch)
tree0f5440da7b11b227e638a33e2d3600622c41e6c7 /src/db/sysdb_selinux.c
parent28943451c1b0f01845266b0f13cc3772c2b1d66f (diff)
downloadsssd-3a59cbd0b7b9c5dd3c62ac1679876070c264d80f.tar.gz
sssd-3a59cbd0b7b9c5dd3c62ac1679876070c264d80f.tar.xz
sssd-3a59cbd0b7b9c5dd3c62ac1679876070c264d80f.zip
Unify usage of sysdb transactions (part 2).
Diffstat (limited to 'src/db/sysdb_selinux.c')
-rw-r--r--src/db/sysdb_selinux.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/db/sysdb_selinux.c b/src/db/sysdb_selinux.c
index 976489503..565b7612f 100644
--- a/src/db/sysdb_selinux.c
+++ b/src/db/sysdb_selinux.c
@@ -174,7 +174,10 @@ static errno_t sysdb_store_selinux_entity(struct sysdb_ctx *sysdb,
}
ret = sysdb_transaction_start(sysdb);
- if (ret != EOK) goto done;
+ if (ret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to start transaction\n"));
+ goto done;
+ }
in_transaction = true;
@@ -212,22 +215,21 @@ static errno_t sysdb_store_selinux_entity(struct sysdb_ctx *sysdb,
ret = ldb_modify(sysdb->ldb, rm_msg);
}
+ ret = sysdb_transaction_commit(sysdb);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to commit transaction\n"));
+ goto done;
+ }
+ in_transaction = false;
+
done:
if (in_transaction) {
- if (ret == EOK) {
- sret = sysdb_transaction_commit(sysdb);
- if (sret != EOK) {
- DEBUG(SSSDBG_OP_FAILURE, ("Could not commit transaction\n"));
- }
- }
-
- if (ret != EOK || sret != EOK){
- sret = sysdb_transaction_cancel(sysdb);
- if (sret != EOK) {
- DEBUG(SSSDBG_OP_FAILURE, ("Could not cancel transaction\n"));
- }
+ sret = sysdb_transaction_cancel(sysdb);
+ if (sret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE, ("Could not cancel transaction\n"));
}
}
+
if (ret) {
DEBUG(SSSDBG_MINOR_FAILURE, ("Error: %d (%s)\n", ret, strerror(ret)));
}