return 0;
}
-/* open a file and lock it */
-FILE *mx_open_file_lock (const char *path, const char *mode)
-{
- FILE *f;
-
- if ((f = safe_fopen (path, mode)) != NULL)
- {
- if (mx_lock_file (path, fileno (f), *mode != 'r', 1, 1) != 0)
- {
- fclose (f);
- f = NULL;
- }
- }
-
- return (f);
-}
-
void mx_unlink_empty (const char *path)
{
int fd;
magic = M_MBOX;
else if (mutt_strcmp (MMDF_SEP, tmp) == 0)
magic = M_MMDF;
- fclose (f);
+ safe_fclose (&f);
#ifndef BUFFY_SIZE
/* need to restore the times here, the file was not really accessed,
* only the type was accessed. This is important, because detection
else
{
mutt_error (_("Couldn't lock %s\n"), ctx->path);
- fclose (ctx->fp);
+ safe_fclose (&ctx->fp);
}
return (-1);
}
safe_free ((void **) &ctx->pattern);
if (ctx->limit_pattern)
mutt_pattern_free (&ctx->limit_pattern);
- if (ctx->fp)
- fclose (ctx->fp);
+ safe_fclose (ctx->fp);
memset (ctx, 0, sizeof (CONTEXT));
}
void mx_update_context (CONTEXT *);
void mx_update_tables (CONTEXT *, int);
-FILE *mx_open_file_lock (const char *, const char *);
-
int mx_lock_file (const char *, int, int, int, int);
int mx_unlock_file (const char *path, int fd, int dot);