diff options
author | Michael Adam <obnox@samba.org> | 2014-03-20 11:23:05 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-04-03 00:26:28 +0200 |
commit | 6ec437ccb5f96871589180d976e9ff44a764b11d (patch) | |
tree | 42474495e553823731d426141a30710adda12ec4 | |
parent | 70cfe221b05a79f890c0e1758c265335f08bb3e6 (diff) | |
download | samba-6ec437ccb5f96871589180d976e9ff44a764b11d.tar.gz samba-6ec437ccb5f96871589180d976e9ff44a764b11d.tar.xz samba-6ec437ccb5f96871589180d976e9ff44a764b11d.zip |
autorid: reverse logic flow in idmap_autorid_init_hwm(), decreasing indentation.
I.e. move writing case to the end.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | source3/winbindd/idmap_autorid_tdb.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/source3/winbindd/idmap_autorid_tdb.c b/source3/winbindd/idmap_autorid_tdb.c index 190999eb79..c347662e01 100644 --- a/source3/winbindd/idmap_autorid_tdb.c +++ b/source3/winbindd/idmap_autorid_tdb.c @@ -395,20 +395,24 @@ NTSTATUS idmap_autorid_init_hwm(struct db_context *db, const char *hwm) uint32_t hwmval; status = dbwrap_fetch_uint32_bystring(db, hwm, &hwmval); - if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) { - status = dbwrap_trans_store_uint32_bystring(db, hwm, 0); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(0, - ("Unable to initialise HWM (%s) in autorid " - "database: %s\n", hwm, nt_errstr(status))); - return NT_STATUS_INTERNAL_DB_ERROR; - } - } else if (!NT_STATUS_IS_OK(status)) { + if (NT_STATUS_IS_OK(status)) { + DEBUG(1, ("HWM (%s) already initialized in autorid database " + "(value %"PRIu32").\n", hwm, hwmval)); + return NT_STATUS_OK; + } + if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) { DEBUG(0, ("unable to fetch HWM (%s) from autorid " "database: %s\n", hwm, nt_errstr(status))); return status; } + status = dbwrap_trans_store_uint32_bystring(db, hwm, 0); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0, ("Error initializing HWM (%s) in autorid database: " + "%s\n", hwm, nt_errstr(status))); + return NT_STATUS_INTERNAL_DB_ERROR; + } + return NT_STATUS_OK; } |