#include <lib-sys/mutt_signal.h>
#include <lib-sys/unix.h>
-#include <lib-ui/curses.h>
+#include <lib-ui/lib-ui.h>
#include "mutt.h"
return 0;
}
-int mutt_open_read_compressed (CONTEXT * ctx)
+int mutt_open_read_compressed(CONTEXT * ctx)
{
char *cmd;
FILE *fp;
ctx->realpath = ctx->path;
/* Uncompress to /tmp */
- tmpfd = m_tempfd(tmppath, sizeof(tmppath), NONULL(Tempdir), NULL);
+ tmpfd = m_tempfd(tmppath, sizeof(tmppath), NONULL(mod_core.tmpdir), NULL);
/* If we cannot open tempfile, that means the file already exists (!?)
* or we are following a symlink, which is bad and insecure.
*/
- if(!tmpfd) {
+ if(tmpfd < 0) {
return -1;
}
close(tmpfd);
-
- ctx->path = p_dupstr(tmppath, m_strlen(tmppath));
+ ctx->path = p_dupstr(tmppath, m_strlen(tmppath));
ctx->cinfo->size = get_size(ctx->realpath);
if (!ctx->quiet)
/* remove the temporary mailbox */
static void remove_file (CONTEXT * ctx)
{
- if (ctx->magic == M_MBOX || ctx->magic == M_MMDF)
+ if (ctx->magic == M_MBOX)
remove (ctx->path);
}
if (!get_append_command (ctx->path, ctx)) {
if (ci->open && ci->close)
- return mutt_open_read_compressed (ctx);
+ return mutt_open_read_compressed(ctx);
ctx->magic = 0;
p_delete(&ctx->cinfo);
ctx->realpath = ctx->path;
/* Uncompress to /tmp */
- fh = m_tempfile(tmppath, sizeof(tmppath), NONULL(Tempdir), NULL);
+ fh = m_tempfile(tmppath, sizeof(tmppath), NONULL(mod_core.tmpdir), NULL);
m_fclose(&fh);
ctx->path = p_dupstr(tmppath, m_strlen(tmppath));
ctx->magic = DefaultMagic;
- if (is_new (ctx->realpath) ||
- (ctx->magic != M_MBOX &&
- ctx->magic != M_MMDF))
+ if (is_new (ctx->realpath) || ctx->magic != M_MBOX)
unlink(tmppath);
/* No error checking - the parent function will catch it */
-
return 0;
}
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);
- else
- remove_file (ctx);
-
+ remove_file (ctx);
restore_path (ctx);
p_delete(&ctx->cinfo);
}