[PATCH 7/7] CLI: add simple error handling for talloc logging

2013-01-19 Thread da...@tethera.net
From: David Bremner 

This really should have been there before. I think it's better to do
the actual operation and then possibly fail writing the memory log,
but it would not be too hard to change it to abort earlier.
---
 notmuch.c |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/notmuch.c b/notmuch.c
index f8d4b35..c3336e8 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -301,7 +301,12 @@ main (int argc, char *argv[])

if (leak_report && (strcmp (leak_report, "") != 0)) {
FILE *report = fopen (leak_report, "w");
-   talloc_report_full (NULL, report);
+   if (report) {
+   talloc_report_full (NULL, report);
+   } else {
+   ret = 1;
+   perror (leak_report);
+   }
}

return ret;
-- 
1.7.10.4



[PATCH 7/7] CLI: add simple error handling for talloc logging

2013-01-19 Thread david
From: David Bremner brem...@debian.org

This really should have been there before. I think it's better to do
the actual operation and then possibly fail writing the memory log,
but it would not be too hard to change it to abort earlier.
---
 notmuch.c |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/notmuch.c b/notmuch.c
index f8d4b35..c3336e8 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -301,7 +301,12 @@ main (int argc, char *argv[])
 
if (leak_report  (strcmp (leak_report, ) != 0)) {
FILE *report = fopen (leak_report, w);
-   talloc_report_full (NULL, report);
+   if (report) {
+   talloc_report_full (NULL, report);
+   } else {
+   ret = 1;
+   perror (leak_report);
+   }
}
 
return ret;
-- 
1.7.10.4

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch