notmuch setup/new: Propagate failure from notmuch_database_set_timestamp
authorCarl Worth <cworth@cworth.org>
Sun, 25 Oct 2009 05:11:38 +0000 (22:11 -0700)
committerCarl Worth <cworth@cworth.org>
Sun, 25 Oct 2009 05:11:38 +0000 (22:11 -0700)
With some recent testing, the timestamp was failing, (overflowing
the term limit), and reporting an error, but the top-level notmuch
command was still returning a success return value.

I think it's high time to add a test suite, (and the code base is
small enough that if we add it now it shouldn't be *too* hard to
shoot for a very high coverage percentage).

notmuch.c

index 8981ff3955f1f66413a6f06996a2d76a1201cf6b..515ec213f2f0d49c618ed3a9a92724a3dbab6b8b 100644 (file)
--- a/notmuch.c
+++ b/notmuch.c
@@ -270,7 +270,9 @@ add_files_recursive (notmuch_database_t *notmuch,
        next = NULL;
     }
 
-    notmuch_database_set_timestamp (notmuch, path, path_mtime);
+    status = notmuch_database_set_timestamp (notmuch, path, path_mtime);
+    if (status && ret == NOTMUCH_STATUS_SUCCESS)
+       ret = status;
 
   DONE:
     if (next)