* mu-cmd-find.c: --format=links: don't show error when there isn't any + unit test

This commit is contained in:
Dirk-Jan C. Binnema
2012-02-23 20:35:16 +02:00
parent 5f9aed0ce0
commit 25a046536d
2 changed files with 73 additions and 13 deletions

View File

@ -404,10 +404,8 @@ create_linksdir_maybe (const char *linksdir, gboolean clearlinks)
return TRUE;
fail:
if (err) {
g_warning ("%s", err->message ? err->message : "unknown error");
g_error_free (err);
}
g_warning ("%s", err->message ? err->message : "unknown error");
g_clear_error (&err);
return FALSE;
}
@ -428,11 +426,9 @@ link_message (const char *src, const char *destdir)
err = NULL;
if (!mu_maildir_link (src, destdir, &err)) {
if (err) {
g_warning ("%s", err->message ?
err->message : "unknown error");
g_error_free (err);
}
g_warning ("%s", err->message ? err->message :
"unknown error");
g_clear_error (&err);
return FALSE;
}
@ -476,14 +472,12 @@ output_links (MuMsgIter *iter, const char* linksdir, gboolean clearlinks,
return FALSE;
}
if (count) {
if (count == 0) {
g_set_error (err, 0, MU_ERROR_NO_MATCHES,
"no existing matches for search expression");
"no matches for search expression");
return FALSE;
}
return TRUE;
}