aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch-compact.c
diff options
context:
space:
mode:
authorGravatar Jani Nikula <jani@nikula.org>2013-11-03 14:24:47 +0200
committerGravatar David Bremner <david@tethera.net>2013-11-07 06:51:16 -0400
commit00d2ac2b41a6dba060837244ee87edce2fd1e465 (patch)
treebc4c548af1e60690b11f0acd76c4ab2c259ac230 /notmuch-compact.c
parent20abbe89a3014ff27978aea7be0cffbc715935ca (diff)
lib: use the compaction backup path provided by the caller
The extra path component added by the lib is a magic value that the caller just has to know. This is demonstrated by the current code, which indeed has "xapian.old" both sides of the interface. Use the backup path provided by the lib caller verbatim, without adding anything to it.
Diffstat (limited to 'notmuch-compact.c')
-rw-r--r--notmuch-compact.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/notmuch-compact.c b/notmuch-compact.c
index ee7afcf6..55dc7316 100644
--- a/notmuch-compact.c
+++ b/notmuch-compact.c
@@ -32,9 +32,13 @@ notmuch_compact_command (notmuch_config_t *config,
unused (char *argv[]))
{
const char *path = notmuch_config_get_database_path (config);
- const char *backup_path = path;
+ const char *backup_path;
notmuch_status_t ret;
+ backup_path = talloc_asprintf (config, "%s/xapian.old", path);
+ if (! backup_path)
+ return 1;
+
printf ("Compacting database...\n");
ret = notmuch_database_compact (path, backup_path, status_update_cb, NULL);
if (ret) {
@@ -42,11 +46,11 @@ notmuch_compact_command (notmuch_config_t *config,
} else {
printf ("\n");
printf ("\n");
- printf ("The old database has been moved to %s/xapian.old", backup_path);
+ printf ("The old database has been moved to %s", backup_path);
printf ("\n");
printf ("To delete run,\n");
printf ("\n");
- printf (" rm -R %s/xapian.old\n", backup_path);
+ printf (" rm -R %s\n", backup_path);
printf ("\n");
}