Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: LGPL-2.1
0002 // Copyright (C) 2018, 2019 Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
0003 //
0004 #ifndef HAVE_GET_CURRENT_DIR_NAME
0005 #include "get_current_dir_name.h"
0006 #include <limits.h>
0007 #include <string.h>
0008 #include <unistd.h>
0009 
0010 /* Android's 'bionic' library, for one, doesn't have this */
0011 
0012 char *get_current_dir_name(void)
0013 {
0014     char pwd[PATH_MAX];
0015 
0016     return getcwd(pwd, sizeof(pwd)) == NULL ? NULL : strdup(pwd);
0017 }
0018 #endif // HAVE_GET_CURRENT_DIR_NAME