[rrd-developers] Hurd build failure

Jean-Michel Vourgère nirgal at debian.org
Tue Jul 28 15:13:18 CEST 2015


Tobias Oetiker wrote:
> Yesterday Jean-Michel Vourgère wrote:
>> --- rrdtool.orig/src/rrd_tool.c
>> +++ rrdtool/src/rrd_tool.c
>> @@ -598,4 +598,7 @@ int HandleInputLine(
>> +#ifdef __GLIBC__
>> +            cwd = get_current_dir_name();
>> +#else
>>              cwd = getcwd(NULL, MAXPATH);
>> +#endif
>>              if (cwd == NULL) {
>>                  printf("ERROR: getcwd %s\n", rrd_strerror(errno));
>>                  return (1);

> for the second part you should ammend configure.ac to test for the
> presence of the get_current_dir_name function
> 
> AND I would like to only use it when not MAXPATH is present

I agree the ifdef __GLIBC__ was quite ugly.

Isn't this enough? :
> #ifdef MAXPATH
>   cwd = getcwd(NULL, MAXPATH);
> #else
>   cwd = get_current_dir_name();
> #endif

Or would you prefer this (after updating configure.ac) ?
> #ifdef MAXPATH
>   cwd = getcwd(NULL, MAXPATH);
> #elif define(HAVE_GET_CURRENT_DIR_NAME)
>   cwd = get_current_dir_name();
> #else
> #error "you must have either MAXPATH or get_current_dir_name()"
> #endif


Before I go on with the patches I have another base question:
src/rrd_config_bottom.h contains:
> #ifdef HAVE_SYS_PARAM_H
> # include <sys/param.h>
> #endif
> #ifndef MAXPATH
> # ifdef PATH_MAX
> #  define MAXPATH PATH_MAX
> # endif
> #endif
> #ifndef MAXPATH
> /* else try the BSD variant */
> # ifdef MAXPATHLEN
> #  define MAXPATH MAXPATHLEN
> # endif
> #endif

So I guess one should change all occurrences of PATH_MAX
(src/rrd_client.c, src/rrd_daemon.c) by MAXPATH, right?
Or am I missing something?

Also rrd_graph.h contains:
> #ifdef WIN32
> #  include <windows.h>
> #  define MAXPATH MAX_PATH
> #endif

Wouldn't it make sense to move the windows specific code in
src/rrd_config_bottom.h ?
> #ifdef HAVE_SYS_PARAM_H
> # include <sys/param.h>
> #endif
> #ifndef MAXPATH
> # ifdef PATH_MAX
> #  define MAXPATH PATH_MAX
> # endif
> #endif
> #ifndef MAXPATH
> /* else try the BSD variant */
> # ifdef MAXPATHLEN
> #  define MAXPATH MAXPATHLEN
> # endif
> #endif
> #if !defined(MAXPATH) && defined(WIN32)
> #  include <windows.h>
> #  define MAXPATH MAX_PATH
> #endif

-- 
Nirgal



More information about the rrd-developers mailing list