File 0001-catch-exceptions-by-reference.patch of Package muchsync

From 7e0bec5f1375329b460ab4b3c5d808d126f2bb48 Mon Sep 17 00:00:00 2001
From: David Mazieres <dm@uun.org>
Date: Wed, 1 Aug 2018 09:15:58 -0700
Subject: [PATCH 1/5] catch exceptions by reference

---
 muchsync.cc    | 8 ++++----
 protocol.cc    | 2 +-
 sql_db.cc      | 4 ++--
 xapian_sync.cc | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/muchsync.cc b/muchsync.cc
index 1b65e82..8d96691 100644
--- a/muchsync.cc
+++ b/muchsync.cc
@@ -141,7 +141,7 @@ id_request()
   unique_ptr<notmuch_db> nmp;
   try {
     nmp.reset(new notmuch_db (opt_notmuch_config));
-  } catch (whattocatch_t e) { cerr << e.what() << '\n'; exit (1); }
+  } catch (whattocatch_t &e) { cerr << e.what() << '\n'; exit (1); }
   notmuch_db &nm = *nmp;
 
   string dbpath = nm.maildir + muchsync_dbpath;
@@ -179,7 +179,7 @@ server()
   unique_ptr<notmuch_db> nmp;
   try {
     nmp.reset(new notmuch_db (opt_notmuch_config));
-  } catch (whattocatch_t e) { cerr << e.what() << '\n'; exit (1); }
+  } catch (whattocatch_t &e) { cerr << e.what() << '\n'; exit (1); }
   notmuch_db &nm = *nmp;
 
   string dbpath = nm.maildir + muchsync_dbpath;
@@ -311,7 +311,7 @@ client(int ac, char **av)
   else {
     try {
       nmp.reset(new notmuch_db (opt_notmuch_config));
-    } catch (whattocatch_t e) { cerr << e.what() << '\n'; exit (1); }
+    } catch (whattocatch_t &e) { cerr << e.what() << '\n'; exit (1); }
   }
 
   if (ac == 0) {
@@ -348,7 +348,7 @@ client(int ac, char **av)
     create_config(in, out, opt_init_dest);
     try {
       nmp.reset(new notmuch_db (opt_notmuch_config, true));
-    } catch (whattocatch_t e) { cerr << e.what() << '\n'; exit (1); }
+    } catch (whattocatch_t &e) { cerr << e.what() << '\n'; exit (1); }
   }
   if (!muchsync_init(nmp->maildir, true))
     exit(1);
diff --git a/protocol.cc b/protocol.cc
index 94954bf..40371fc 100644
--- a/protocol.cc
+++ b/protocol.cc
@@ -788,7 +788,7 @@ muchsync_server(sqlite3 *db, notmuch_db &nm)
 	    cout << "250 ok\n";
 	  }
 	}
-	catch (exception e) {
+	catch (exception &e) {
 	  cerr << e.what() << '\n';
 	  cout << "550 " << e.what() << '\n';
 	}
diff --git a/sql_db.cc b/sql_db.cc
index 145164a..7de8e90 100644
--- a/sql_db.cc
+++ b/sql_db.cc
@@ -101,7 +101,7 @@ dbcreate (const char *path)
     sqlexec (db, "INSERT INTO sync_vector (replica, version)"
 	     " VALUES (%lld, 1);", self);
     sqlexec (db, "COMMIT;");
-  } catch (sqlerr_t exc) {
+  } catch (sqlerr_t &exc) {
     sqlite3_close_v2 (db);
     cerr << exc.what () << '\n';
     return nullptr;
@@ -133,7 +133,7 @@ dbopen (const char *path, bool exclusive)
     }
     getconfig<i64> (db, "self");
   }
-  catch (sqldone_t) {
+  catch (sqldone_t &) {
     cerr << path << ": invalid configuration\n";
     sqlite3_close_v2 (db);
     return nullptr;
diff --git a/xapian_sync.cc b/xapian_sync.cc
index 5ab8422..8d56882 100644
--- a/xapian_sync.cc
+++ b/xapian_sync.cc
@@ -656,7 +656,7 @@ sync_local_data (sqlite3 *sqldb, const string &maildir)
 
     xapian_scan (sqldb, ws, maildir);
   }
-  catch (...) {
+  catch (exception &e) {
     sqlexec (sqldb, "ROLLBACK TO localsync;");
     throw;
   }
-- 
2.20.1
openSUSE Build Service is sponsored by