File 0002-print-file-opening-error.patch of Package muchsync

From 05290a10f1f50a1533f230fc78ae5962cad8c3a0 Mon Sep 17 00:00:00 2001
From: David Mazieres <dm@uun.org>
Date: Mon, 3 Sep 2018 09:12:54 -0700
Subject: [PATCH 2/5] print file opening error

---
 notmuch_db.cc | 4 ++++
 sql_db.cc     | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/notmuch_db.cc b/notmuch_db.cc
index 402a59d..7b9b0c6 100644
--- a/notmuch_db.cc
+++ b/notmuch_db.cc
@@ -60,7 +60,11 @@ notmuch_db::add_message(const string &path, const tags_t *newtags,
 {
   notmuch_status_t err;
   notmuch_message_t *message;
+#if LIBNOTMUCH_CHECK_VERSION(5,1,0)
+  err = notmuch_database_index_file(notmuch(), path.c_str(), nullptr, &message);
+#else // libnotmuch < 5.1.0
   err = notmuch_database_add_message(notmuch(), path.c_str(), &message);
+#endif // libnotmuch < 5.1.0
   if (err != NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) {
     nmtry("notmuch_database_add_message", err);
     set_tags(message, newtags ? *newtags : new_tags);
diff --git a/sql_db.cc b/sql_db.cc
index 7de8e90..a17c5ca 100644
--- a/sql_db.cc
+++ b/sql_db.cc
@@ -1,4 +1,5 @@
 
+#include <cstring>
 #include <functional>
 #include <iomanip>
 #include <iostream>
@@ -443,6 +444,8 @@ hash_lookup::content()
     if (content_.is_open())
       return content_.rdbuf();
   }
+  if (opt_verbose > 1 && nlinks() > 0)
+    cerr << link_path(nlinks()-1) << ": " << strerror(errno) << "\n";
   return nullptr;
 }
 
-- 
2.20.1
openSUSE Build Service is sponsored by