mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-01 07:04:10 +01:00
CLI: add simple error handling for talloc logging
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.
This commit is contained in:
parent
8fc5f3b666
commit
d037040997
1 changed files with 7 additions and 5 deletions
10
notmuch.c
10
notmuch.c
|
@ -294,10 +294,6 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
ret = (command->function)(local, argc - opt_index, argv + opt_index);
|
ret = (command->function)(local, argc - opt_index, argv + opt_index);
|
||||||
|
|
||||||
/* in the future support for this environment variable may
|
|
||||||
* be supplemented or replaced by command line arguments
|
|
||||||
* --leak-report and/or --leak-report-full */
|
|
||||||
|
|
||||||
talloc_report = getenv ("NOTMUCH_TALLOC_REPORT");
|
talloc_report = getenv ("NOTMUCH_TALLOC_REPORT");
|
||||||
|
|
||||||
/* this relies on the previous call to
|
/* this relies on the previous call to
|
||||||
|
@ -305,7 +301,13 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
if (talloc_report && strcmp (talloc_report, "") != 0) {
|
if (talloc_report && strcmp (talloc_report, "") != 0) {
|
||||||
FILE *report = fopen (talloc_report, "w");
|
FILE *report = fopen (talloc_report, "w");
|
||||||
|
if (report) {
|
||||||
talloc_report_full (NULL, report);
|
talloc_report_full (NULL, report);
|
||||||
|
} else {
|
||||||
|
ret = 1;
|
||||||
|
fprintf (stderr, "ERROR: unable to write talloc log. ");
|
||||||
|
perror (talloc_report);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue