* mu-cmd: don't stop when sources for links are missing

This commit is contained in:
Dirk-Jan C. Binnema 2010-01-02 16:06:36 +02:00
parent 09b8437a8a
commit 7c3b89fcc1
1 changed files with 15 additions and 6 deletions

View File

@ -22,6 +22,7 @@
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include "mu-msg-gmime.h" #include "mu-msg-gmime.h"
#include "mu-maildir.h" #include "mu-maildir.h"
@ -225,15 +226,23 @@ _do_output_links (MuQueryXapian *xapian, MuConfigOptions* opts,
pathfield = mu_msg_field_from_id (MU_MSG_FIELD_ID_PATH); pathfield = mu_msg_field_from_id (MU_MSG_FIELD_ID_PATH);
/* iterate over the found rows */ /* iterate over the found rows */
while (!mu_msg_xapian_is_done (row)) { for (;!mu_msg_xapian_is_done (row); mu_msg_xapian_next (row)) {
const char *path; const char *path;
path = mu_msg_xapian_get_field (row, pathfield); path = mu_msg_xapian_get_field (row, pathfield);
if (path) { if (!path)
retval = mu_maildir_link (path, opts->linksdir); continue;
if (!retval)
break; /* this might happen if the database is not up-to-date */
if (access (path, R_OK) != 0) {
g_warning ("Cannot read source message %s: %s",
path, strerror (errno));
continue;
} }
mu_msg_xapian_next (row);
if (!mu_maildir_link (path, opts->linksdir))
break;
} }
mu_msg_xapian_destroy (row); mu_msg_xapian_destroy (row);