X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-mx%2Fcompress.c;h=00064b76d0f38aa1a4ae19f1f8f377b4876639d4;hp=3770fef1ec87a4116430f9ff559111c8422637de;hb=3242c00b2d3f7f1c1554bcebfb8a390fddea095f;hpb=8476307969a605bea67f6b702b0c1e7a52038bed diff --git a/lib-mx/compress.c b/lib-mx/compress.c index 3770fef..00064b7 100644 --- a/lib-mx/compress.c +++ b/lib-mx/compress.c @@ -142,7 +142,7 @@ static const char *compresshook_format_str (char *dest, ssize_t destlen, unsigned long data, format_flag flags __attribute__ ((unused))) { - char tmp[SHORT_STRING]; + char tmp[STRING]; CONTEXT *ctx = (CONTEXT *) data; @@ -171,8 +171,8 @@ static char *get_compression_cmd (const char *cmd, const CONTEXT * ctx) { char expanded[_POSIX_PATH_MAX]; - mutt_FormatString (expanded, sizeof (expanded), cmd, - compresshook_format_str, (unsigned long) ctx, 0); + m_strformat(expanded, sizeof (expanded), cmd, compresshook_format_str, + (unsigned long)ctx, 0); return m_strdup(expanded); } @@ -221,7 +221,7 @@ int mutt_open_read_compressed (CONTEXT * ctx) } mutt_block_signals (); if (mbox_lock_compressed (ctx, fp, 0, 1) == -1) { - fclose (fp); + m_fclose(&fp); mutt_unblock_signals (); mutt_error _("Unable to lock mailbox!"); @@ -236,7 +236,7 @@ int mutt_open_read_compressed (CONTEXT * ctx) rc = mutt_system (cmd); mbox_unlock_compressed (ctx, fp); mutt_unblock_signals (); - fclose (fp); + m_fclose(&fp); if (rc) { mutt_any_key_to_continue (NULL); @@ -290,7 +290,7 @@ int mutt_open_append_compressed (CONTEXT * ctx) if (!is_new (ctx->realpath)) if (ctx->magic == M_MBOX || ctx->magic == M_MMDF) if ((fh = safe_fopen (ctx->path, "w"))) - fclose (fh); + m_fclose(&fh); /* No error checking - the parent function will catch it */ return (0); @@ -300,9 +300,8 @@ int mutt_open_append_compressed (CONTEXT * ctx) void mutt_fast_close_compressed (CONTEXT * ctx) { if (ctx->cinfo) { - if (ctx->fp) - fclose (ctx->fp); - ctx->fp = NULL; + m_fclose(&ctx->fp); + /* if the folder was removed, remove the gzipped folder too */ if (access (ctx->path, F_OK) != 0 && !option (OPTSAVEEMPTY)) remove (ctx->realpath); @@ -335,7 +334,7 @@ int mutt_sync_compressed (CONTEXT * ctx) } mutt_block_signals (); if (mbox_lock_compressed (ctx, fp, 1, 1) == -1) { - fclose (fp); + m_fclose(&fp); mutt_unblock_signals (); mutt_error _("Unable to lock mailbox!"); @@ -359,7 +358,7 @@ int mutt_sync_compressed (CONTEXT * ctx) mbox_unlock_compressed (ctx, fp); mutt_unblock_signals (); - fclose (fp); + m_fclose(&fp); p_delete(&cmd); @@ -383,9 +382,7 @@ int mutt_slow_close_compressed (CONTEXT * ctx) return (0); } - if (ctx->fp) - fclose (ctx->fp); - ctx->fp = NULL; + m_fclose(&ctx->fp); if (!ctx->quiet) { if (append == ci->close) @@ -405,7 +402,7 @@ int mutt_slow_close_compressed (CONTEXT * ctx) } mutt_block_signals (); if (mbox_lock_compressed (ctx, fp, 1, 1) == -1) { - fclose (fp); + m_fclose(&fp); mutt_unblock_signals (); mutt_error _("Unable to lock mailbox!"); @@ -430,13 +427,13 @@ int mutt_slow_close_compressed (CONTEXT * ctx) p_delete(&cmd); mbox_unlock_compressed (ctx, fp); mutt_unblock_signals (); - fclose (fp); + m_fclose(&fp); return (-1); } mbox_unlock_compressed (ctx, fp); mutt_unblock_signals (); - fclose (fp); + m_fclose(&fp); remove_file (ctx); restore_path (ctx); p_delete(&cmd);