mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 12:28:09 +01:00
test: improve error handling in lib-error tests
There is at least one bug fixed here (missing parameter to printf), even if exiting via segfault is considered OK.
This commit is contained in:
parent
fd6f65f241
commit
45df509cb6
1 changed files with 8 additions and 4 deletions
|
@ -202,16 +202,20 @@ int main (int argc, char** argv)
|
||||||
notmuch_database_t *db;
|
notmuch_database_t *db;
|
||||||
notmuch_status_t stat;
|
notmuch_status_t stat;
|
||||||
char *path;
|
char *path;
|
||||||
|
char *msg = NULL;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
stat = notmuch_database_open (argv[1], NOTMUCH_DATABASE_MODE_READ_WRITE, &db);
|
stat = notmuch_database_open_verbose (argv[1], NOTMUCH_DATABASE_MODE_READ_WRITE, &db, &msg);
|
||||||
if (stat != NOTMUCH_STATUS_SUCCESS) {
|
if (stat != NOTMUCH_STATUS_SUCCESS) {
|
||||||
fprintf (stderr, "error opening database: %d\n", stat);
|
fprintf (stderr, "error opening database: %d %s\n", stat, msg ? msg : "");
|
||||||
|
exit (1);
|
||||||
}
|
}
|
||||||
path = talloc_asprintf (db, "%s/.notmuch/xapian/postlist.DB", argv[1]);
|
path = talloc_asprintf (db, "%s/.notmuch/xapian/postlist.DB", argv[1]);
|
||||||
fd = open(path,O_WRONLY|O_TRUNC);
|
fd = open(path,O_WRONLY|O_TRUNC);
|
||||||
if (fd < 0)
|
if (fd < 0) {
|
||||||
fprintf (stderr, "error opening %s\n");
|
fprintf (stderr, "error opening %s\n", argv[1]);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
EOF
|
EOF
|
||||||
cat <<'EOF' > c_tail
|
cat <<'EOF' > c_tail
|
||||||
if (stat) {
|
if (stat) {
|
||||||
|
|
Loading…
Reference in a new issue