From: Carl Worth <cworth@cworth.org>
Date: Sun, 25 Oct 2009 05:11:38 +0000 (-0700)
Subject: notmuch setup/new: Propagate failure from notmuch_database_set_timestamp
X-Git-Tag: 0.1~732
X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=309c0e1cc5757e153263b580e60f613f45df630e;p=obsolete%2Fnotmuch-old

notmuch setup/new: Propagate failure from notmuch_database_set_timestamp

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).
---

diff --git a/notmuch.c b/notmuch.c
index 8981ff39..515ec213 100644
--- 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)