[rrd-developers] Hurd build failure

Tobias Oetiker tobi at oetiker.ch
Tue Jul 28 16:16:27 CEST 2015


Hi Jean-Michel,

Today Jean-Michel Vourgère wrote:

> 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

yep ... since you would otherwhise just assume the presence of
get_current_dir_name despite it being a gnu extension.

> 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?

yes that would be sensible I think ...

> 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

sorry I am not paying too close attention to the windows port ...
but they are not running configure, so they would have to read this
file otherwise ...

cheers
tobi


>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
www.oetiker.ch tobi at oetiker.ch +41 62 775 9902


More information about the rrd-developers mailing list