mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
lib/n_d_needs_upgrade: handle error return from n_d_get_version
Also clarify documentation of error return from n_d_needs_upgrade.
This commit is contained in:
parent
cf90431cbf
commit
f25fc8e211
3 changed files with 13 additions and 4 deletions
|
@ -1395,9 +1395,17 @@ notmuch_database_get_version (notmuch_database_t *notmuch)
|
|||
notmuch_bool_t
|
||||
notmuch_database_needs_upgrade (notmuch_database_t *notmuch)
|
||||
{
|
||||
return notmuch->mode == NOTMUCH_DATABASE_MODE_READ_WRITE &&
|
||||
((NOTMUCH_FEATURES_CURRENT & ~notmuch->features) ||
|
||||
(notmuch_database_get_version (notmuch) < NOTMUCH_DATABASE_VERSION));
|
||||
unsigned int version;
|
||||
|
||||
if (notmuch->mode != NOTMUCH_DATABASE_MODE_READ_WRITE)
|
||||
return FALSE;
|
||||
|
||||
if (NOTMUCH_FEATURES_CURRENT & ~notmuch->features)
|
||||
return TRUE;
|
||||
|
||||
version = notmuch_database_get_version (notmuch);
|
||||
|
||||
return (version > 0 && version < NOTMUCH_DATABASE_VERSION);
|
||||
}
|
||||
|
||||
static volatile sig_atomic_t do_progress_notify = 0;
|
||||
|
|
|
@ -447,6 +447,8 @@ notmuch_database_get_version (notmuch_database_t *database);
|
|||
* FALSE for a read-only database because there's no way to upgrade a
|
||||
* read-only database.
|
||||
*
|
||||
* Also returns FALSE if an error occurs accessing the database.
|
||||
*
|
||||
*/
|
||||
notmuch_bool_t
|
||||
notmuch_database_needs_upgrade (notmuch_database_t *database);
|
||||
|
|
|
@ -132,7 +132,6 @@ EOF
|
|||
test_expect_equal_file EXPECTED OUTPUT
|
||||
|
||||
test_begin_subtest "check a closed db for upgrade"
|
||||
test_subtest_known_broken
|
||||
cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
|
||||
{
|
||||
notmuch_bool_t ret;
|
||||
|
|
Loading…
Reference in a new issue