strftime (date, sizeof (date), "%Y-%m-%d", localtime (&tt));
if (!more)
- fprintf (*fp, "%s %5.5s %d/%8s %s %s\n", more ? "sub" : "pub",
+ fprintf (*fp, "pub %5.5s %d/%8s %s %s\n",
gpgme_pubkey_algo_name (subkey->pubkey_algo), subkey->length,
shortid, date, uid->uid);
else
- fprintf (*fp, "%s %5.5s %d/%8s %s\n", more ? "sub" : "pub",
+ fprintf (*fp, "sub %5.5s %d/%8s %s\n",
gpgme_pubkey_algo_name (subkey->pubkey_algo), subkey->length,
- shortid, date);
+ shortid, date);
subkey = subkey->next;
more = 1;
}
fprintf (fp, _("Valid To ..: %s\n"), shortbuf);
}
- if (subkey)
- s = gpgme_pubkey_algo_name (subkey->pubkey_algo);
- else
- s = "?";
+ s = gpgme_pubkey_algo_name (subkey->pubkey_algo);
- if (subkey)
- aval = subkey->length;
- else
- aval = 0;
+ aval = subkey->length;
/* L10N: DOTFILL */
fprintf (fp, _("Key Type ..: %s, %lu bit %s\n"), "PGP", aval, s);
if (rc != MDB_SUCCESS)
{
fprintf(stderr, "hcache_open_lmdb: mdb_env_create: %s", mdb_strerror(rc));
+ FREE(&ctx);
return NULL;
}
{
char *p = NULL;
char path[_POSIX_PATH_MAX];
- struct stat st;
mutt_encode_path (path, sizeof (path), folder);
/* if the folder is local, canonify the path to avoid
* to ensure equivalent paths share the hcache */
- if (stat (path, &st) == 0)
- {
- p = safe_malloc (PATH_MAX+1);
- if (!realpath (path, p))
- mutt_str_replace (&p, path);
- } else
- p = safe_strdup (path);
+ p = safe_malloc (PATH_MAX+1);
+ if (!realpath (path, p))
+ mutt_str_replace (&p, path);
return p;
}
mutt_hcache_open(const char *path, const char *folder, hcache_namer_t namer)
{
const hcache_ops_t *ops = hcache_get_ops();
- header_cache_t *h = safe_calloc(1, sizeof (header_cache_t));
- struct stat sb;
-
if (!ops)
return NULL;
+ header_cache_t *h = safe_calloc(1, sizeof (header_cache_t));
+
/* Calculate the current hcache version from dynamic configuration */
if (hcachever == 0x0) {
union {
else
{
/* remove a possibly incompatible version */
- if (!stat (path, &sb) && !unlink (path))
+ if (unlink (path) == 0)
{
h->ctx = ops->open(path);
if (h->ctx)
url.path[strlen(url.path) - 1] = '\0';
if (!mutt_strcmp (url.user, ImapUser))
url.user = NULL;
- url_ciss_tostring (&url, buf + 11, sizeof (buf) - 10, 0);
+ url_ciss_tostring (&url, buf + 11, sizeof (buf) - 11, 0);
safe_strcat (buf, sizeof (buf), "\"");
mutt_buffer_init (&token);
mutt_buffer_init (&err);
*filename = e ? e == p ? NULL : strndup(p, e - p) : safe_strdup(p);
if (!e)
- return 0;
+ return 0; /* only filename */
if (*filename && url_pct_decode(*filename) < 0)
goto err;
- if (!e)
- return 0; /* only filename */
++e; /* skip '?' */
p = e;
if (url_parse_query(uri, &data->db_filename, &data->query_items)) {
mutt_error(_("failed to parse notmuch uri: %s"), uri);
- data->db_filename = NULL;
- data->query_items = NULL;
- data->query_type = 0;
+ FREE(&data);
return NULL;
}
return;
data = get_ctxdata(ctx);
+ if (!data)
+ return;
memset(&data->progress, 0, sizeof(data->progress));
data->oldmsgcount = ctx->msgcount;
{
struct nm_ctxdata *data = get_ctxdata(ctx);
- if (ctx->quiet || data->noprogress)
+ if (ctx->quiet || !data || data->noprogress)
return;
if (!data->progress_ready && q) {
const char *path;
HEADER *h = NULL;
+ struct nm_ctxdata *data = get_ctxdata(ctx);
+ if (!data)
+ return;
+
/* deduplicate */
if (dedup && get_mutt_header(ctx, msg)) {
- get_ctxdata(ctx)->ignmsgcount++;
+ data->ignmsgcount++;
nm_progress_update(ctx, q);
dprint(2, (debugfile, "nm: ignore id=%s, already in the context\n",
notmuch_message_get_message_id(msg)));
strfcpy(folder, old, sizeof(folder));
p = strrchr(folder, '/');
- if (p)
+ if (p) {
*p = '\0';
+ p++;
+ } else {
+ p = folder;
+ }
- p++;
strfcpy(filename, p, sizeof(filename));
/* remove (new,cur,...) from folder path */
}
return pat->not ^ result;
}
- return (pat->not ^ (h->env->x_label && patmatch (pat, h->env->x_label) == 0));
#ifdef USE_NOTMUCH
case MUTT_NOTMUCH_LABEL:
{
mutt_socket_write_d (pop_data->conn, buf, -1, dbg);
c = strpbrk (buf, " \r\n");
- *c = '\0';
+ if (c)
+ *c = '\0';
snprintf (pop_data->err_msg, sizeof (pop_data->err_msg), "%s: ", buf);
if (mutt_socket_readln (buf, buflen, pop_data->conn) < 0)
*/
static int draw_divider (int num_rows, int num_cols)
{
- if ((num_rows < 1) || (num_rows < 1))
+ if ((num_rows < 1) || (num_cols < 1))
return 0;
int i;
{
result = strcmp(aptr, bptr);
if (result == 0)
+ {
AUXSORT(result, a, b);
+ }
}
return (SORTCODE(result));
#endif
}
- sigaction (SIGCONT, &oldcont, NULL);
- sigaction (SIGTSTP, &oldtstp, NULL);
+ if (!(flags & MUTT_DETACH_PROCESS))
+ {
+ sigaction (SIGCONT, &oldcont, NULL);
+ sigaction (SIGTSTP, &oldtstp, NULL);
+ }
/* reset SIGINT, SIGQUIT and SIGCHLD */
mutt_unblock_signals_system (1);