X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=muttlib.c;h=c52c58b81e69aa64489c2de41a6d91031aa1a520;hp=72566aa0cdd14cd557254227fb0d9297c64c6e18;hb=11dfc0aa39e31496da16c708f972a6718dd7ee5c;hpb=a9d22903ab440da5d0b4d994d9de49ff2cf663d4 diff --git a/muttlib.c b/muttlib.c index 72566aa..c52c58b 100644 --- a/muttlib.c +++ b/muttlib.c @@ -214,19 +214,25 @@ void mutt_free_parameter (PARAMETER ** p) *p = 0; } -LIST *mutt_add_list (LIST * head, const char *data) -{ +LIST *mutt_add_list (LIST * head, const char *data) { + size_t len = mutt_strlen (data); + return (mutt_add_list_n (head, data, len ? len + 1 : 0)); +} + +LIST *mutt_add_list_n (LIST *head, const void *data, size_t len) { LIST *tmp; for (tmp = head; tmp && tmp->next; tmp = tmp->next); + if (tmp) { tmp->next = safe_malloc (sizeof (LIST)); tmp = tmp->next; - } - else + } else head = tmp = safe_malloc (sizeof (LIST)); - tmp->data = safe_strdup (data); + tmp->data = safe_malloc (len); + if (len) + memcpy (tmp->data, data, len); tmp->next = NULL; return head; } @@ -1225,16 +1231,10 @@ int mutt_save_confirm (const char *s, struct stat *st) } #endif - if (stat (s, st) != -1) { - if (magic == -1) { - mutt_error (_("%s is not a mailbox!"), s); - return 1; - } - + if (magic > 0 && !mx_access (s, W_OK)) { if (option (OPTCONFIRMAPPEND) && - (!TrashPath || (mutt_strcmp (s, TrashPath) != 0))) + (!TrashPath || (mutt_strcmp (s, TrashPath) != 0))) { /* if we're appending to the trash, there's no point in asking */ - { snprintf (tmp, sizeof (tmp), _("Append messages to %s?"), s); if ((rc = mutt_yesorno (tmp, M_YES)) == M_NO) ret = 1; @@ -1242,6 +1242,13 @@ int mutt_save_confirm (const char *s, struct stat *st) ret = -1; } } + + if (stat (s, st) != -1) { + if (magic == -1) { + mutt_error (_("%s is not a mailbox!"), s); + return 1; + } + } else { #ifdef USE_IMAP if (magic != M_IMAP)