summaryrefslogtreecommitdiff
path: root/src/support/filename.c
blob: a886b3f09f991ee836201427be4e4c6d715eaeb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*-
 * Copyright (c) 2008-2012 WiredTiger, Inc.
 *	All rights reserved.
 *
 * See the file LICENSE for redistribution information.
 */

#include "wt_internal.h"

/*
 * __wt_filename --
 *	Build a filename in a scratch buffer.
 */
int
__wt_filename(WT_SESSION_IMPL *session, const char *name, const char **path)
{
	WT_CONNECTION_IMPL *conn;
	size_t len;
	char *buf;

	conn = S2C(session);
	*path = NULL;

	len = strlen(conn->home) + 1 + strlen(name) + 1;
	WT_RET(__wt_calloc(session, 1, len, &buf));
	snprintf(buf, len, "%s/%s", conn->home, name);

	*path = buf;
	return (0);
}