1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

replace: added get_current_dir_name()

This commit is contained in:
Andrew Tridgell 2010-03-05 22:45:27 +11:00
parent ace6d75ae6
commit f3c738f819
3 changed files with 18 additions and 0 deletions

View File

@ -109,6 +109,7 @@ AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename)
AC_CHECK_FUNCS(waitpid wait4 strlcpy strlcat initgroups memmove strdup)
AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp dup2 dprintf vdprintf)
AC_CHECK_FUNCS(isatty chown lchown link readlink symlink realpath fdatasync)
AC_CHECK_FUNCS(get_current_dir_name)
AC_HAVE_DECL(setresuid, [#include <unistd.h>])
AC_HAVE_DECL(setresgid, [#include <unistd.h>])
AC_HAVE_DECL(errno, [#include <errno.h>])

View File

@ -735,3 +735,15 @@ int dprintf(int fd, const char *format, ...)
}
#endif
#ifndef HAVE_GET_CURRENT_DIR_NAME
char *rep_get_current_dir_name(void)
{
char buf[PATH_MAX+1];
char *p;
p = getcwd(buf, sizeof(buf));
if (p == NULL) {
return NULL;
}
return strdup(p);
}
#endif

View File

@ -497,6 +497,11 @@ ssize_t rep_pwrite(int __fd, const void *__buf, size_t __nbytes, off_t __offset)
/* prototype is in "system/network.h" */
#endif
#ifndef HAVE_GET_CURRENT_DIR_NAME
#define get_current_dir_name rep_get_current_dir_name
char *rep_get_current_dir_name(void);
#endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif