DB_ENV *env;
DB *db;
int fd;
- char lockfile[PATH_MAX];
+ struct Buffer lockfile;
};
/**
if (pagesize <= 0)
pagesize = 16384;
- snprintf(ctx->lockfile, sizeof(ctx->lockfile), "%s-lock-hack", path);
+ ctx->lockfile = mutt_buffer_make(128);
+ mutt_buffer_printf(&ctx->lockfile, "%s-lock-hack", path);
- ctx->fd = open(ctx->lockfile, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
+ ctx->fd = open(mutt_b2s(&ctx->lockfile), O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
if (ctx->fd < 0)
{
FREE(&ctx);
mutt_file_unlock(ctx->fd);
fail_close:
close(ctx->fd);
- unlink(ctx->lockfile);
+ unlink(mutt_b2s(&ctx->lockfile));
+ mutt_buffer_dealloc(&ctx->lockfile);
FREE(&ctx);
return NULL;
db->env->close(db->env, 0);
mutt_file_unlock(db->fd);
close(db->fd);
- unlink(db->lockfile);
+ unlink(mutt_b2s(&db->lockfile));
+ mutt_buffer_dealloc(&db->lockfile);
FREE(ptr);
}