From 71bc8365302d0c8b9bf6b7709fb6d47e35bf8b49 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Michel=20Vourg=C3=A8re?= Date: Sun, 2 Aug 2015 15:06:57 +0200 Subject: [PATCH] Hurd compilation: Try get_current_dir_name MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit when MAXPATH is not available, like on hurd platform. Thanks Marc Dequènes. --- configure.ac | 2 +- src/rrd_tool.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 3fabcf4f..e802dcf4 100644 --- a/configure.ac +++ b/configure.ac @@ -251,7 +251,7 @@ AC_C_BIGENDIAN dnl for each function found we get a definition in config.h dnl of the form HAVE_FUNCTION -AC_CHECK_FUNCS(nl_langinfo tzset fsync mbstowcs opendir readdir chdir chroot getgid getuid setgid setuid strndup strerror snprintf vsnprintf vasprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday getpwnam getgrnam) +AC_CHECK_FUNCS(nl_langinfo tzset fsync mbstowcs opendir readdir chdir chroot getgid getuid setgid setuid strndup strerror snprintf vsnprintf vasprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday getpwnam getgrnam get_current_dir_name) AC_FUNC_STRERROR_R diff --git a/src/rrd_tool.c b/src/rrd_tool.c index 63df770d..3e81ce28 100644 --- a/src/rrd_tool.c +++ b/src/rrd_tool.c @@ -595,7 +595,13 @@ int HandleInputLine( printf("ERROR: invalid parameter count for pwd\n"); return (1); } +#ifdef MAXPATH cwd = getcwd(NULL, MAXPATH); +#elif defined(HAVE_GET_CURRENT_DIR_NAME) + cwd = get_current_dir_name(); +#else +#error "You must have either MAXPATH or get_current_dir_name()" +#endif if (cwd == NULL) { printf("ERROR: getcwd %s\n", rrd_strerror(errno)); return (1); -- 2.47.2