summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/get_current_dir_name.c
blob: 01f32f26552d2d0ffe2fa23e75044d250ed8e37a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// SPDX-License-Identifier: LGPL-2.1
// Copyright (C) 2018, 2019 Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
//
#ifndef HAVE_GET_CURRENT_DIR_NAME
#include "get_current_dir_name.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdlib.h>

/* Android's 'bionic' library, for one, doesn't have this */

char *get_current_dir_name(void)
{
	char pwd[PATH_MAX];

	return getcwd(pwd, sizeof(pwd)) == NULL ? NULL : strdup(pwd);
}
#endif // HAVE_GET_CURRENT_DIR_NAME
OpenPOWER on IntegriCloud