diff options
author | Tomi Ollila <tomi.ollila@iki.fi> | 2013-11-15 00:03:27 +0200 |
---|---|---|
committer | David Bremner <david@tethera.net> | 2013-11-19 20:15:02 -0400 |
commit | 2fd7ef64baf02892a7bebfb57d593afb086145ef (patch) | |
tree | bcf3ac156591226c1472e9863522000c93c34bbf /lib/database.cc | |
parent | 6452ae0fcb0a2ee45a47144da71a6de9d8dace2c (diff) |
compact: improve error messages on failures after compaction
The error messages written during the steps replacing old
database with new now includes relevant paths and strerror.
Diffstat (limited to 'lib/database.cc')
-rw-r--r-- | lib/database.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/database.cc b/lib/database.cc index d09ad99f..f395061e 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -942,19 +942,27 @@ notmuch_database_compact (const char *path, } if (rename (xapian_path, backup_path)) { - fprintf (stderr, "Error moving old database out of the way\n"); + fprintf (stderr, "Error moving %s to %s: %s\n", + xapian_path, backup_path, strerror (errno)); ret = NOTMUCH_STATUS_FILE_ERROR; goto DONE; } if (rename (compact_xapian_path, xapian_path)) { - fprintf (stderr, "Error moving compacted database\n"); + fprintf (stderr, "Error moving %s to %s: %s\n", + compact_xapian_path, xapian_path, strerror (errno)); ret = NOTMUCH_STATUS_FILE_ERROR; goto DONE; } - if (! keep_backup) - rmtree (backup_path); + if (! keep_backup) { + if (rmtree (backup_path)) { + fprintf (stderr, "Error removing old database %s: %s\n", + backup_path, strerror (errno)); + ret = NOTMUCH_STATUS_FILE_ERROR; + goto DONE; + } + } DONE: if (notmuch) |