Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / tools / perf / util / get_current_dir_name.c
blobb205d929245f5ee9e54bfe65ee37dcc62bf5469a
1 // SPDX-License-Identifier: LGPL-2.1
2 // Copyright (C) 2018, 2019 Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
3 //
4 #ifndef HAVE_GET_CURRENT_DIR_NAME
5 #include "get_current_dir_name.h"
6 #include <unistd.h>
7 #include <stdlib.h>
9 /* Android's 'bionic' library, for one, doesn't have this */
11 char *get_current_dir_name(void)
13 char pwd[PATH_MAX];
15 return getcwd(pwd, sizeof(pwd)) == NULL ? NULL : strdup(pwd);
17 #endif // HAVE_GET_CURRENT_DIR_NAME