mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 16:29:59 +00:00
![Alexey Dobriyan](/assets/img/avatar_default.png)
strdup() prototype doesn't live in stdlib.h . Add limits.h for PATH_MAX definition as well. This fixes the build on Android. Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@gmail.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Link: http://lore.kernel.org/lkml/YRukaQbrgDWhiwGr@localhost.localdomain Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
18 lines
473 B
C
18 lines
473 B
C
// 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 <limits.h>
|
|
#include <string.h>
|
|
#include <unistd.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
|