aboutsummaryrefslogtreecommitdiff
blob: af0140ea54d3c377a22623eebc76a18b445247e2 (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
/*
 * get_sandbox_conf.c
 *
 * Util functions.
 *
 * Copyright 1999-2008 Gentoo Foundation
 * Licensed under the GPL-2
 */

#include "headers.h"
#include "sbutil.h"

/* Where the file exists in our source tree */
#define LOCAL_SANDBOX_CONF_FILE "/etc/sandbox.conf"

char *get_sandbox_conf(void)
{
	char *ret = SANDBOX_CONF_FILE;
	save_errno();
	if (is_env_on(ENV_SANDBOX_TESTING)) {
		char *abs = getenv("abs_top_srcdir");
		ret = xmalloc(strlen(abs) + strlen(LOCAL_SANDBOX_CONF_FILE) + 1);
		sprintf(ret, "%s%s", abs, LOCAL_SANDBOX_CONF_FILE);
	}
	restore_errno();
	return ret;
}