dnl for each function found we get a definition in config.h
dnl of the form HAVE_FUNCTION
-AC_CHECK_FUNCS(tzset setlocale strerror snprintf vsnprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday)
+AC_CHECK_FUNCS(tzset opendir readdir chdir chroot getuid setlocale strerror snprintf vsnprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday)
dnl HP-UX 11.00 does not have finite but does have isfinite as a macro
AC_CHECK_FUNCS(fpclassify, ,
{
char **myargv;
char aLine[MAX_LENGTH];
+#ifdef HAVE_CHROOT
char *firstdir="";
+#endif
#ifdef MUST_DISABLE_SIGFPE
signal(SIGFPE,SIG_IGN);
#endif
gettimeofday(&starttime,&tz);
#endif
RemoteMode=1;
-#ifndef WIN32
+#ifdef HAVE_CHROOT
if ((argc == 3) && strcmp("",argv[2])){
if (getuid()==0){
chroot(argv[2]);
}
}
#else
- fprintf(stderr,"ERROR: change root only in unix "
- "enviroment posible\n");
+ fprintf(stderr,"ERROR: change root is not supported by your OS "
+ "or at least by this copy of rrdtool\n");
exit(1);
#endif
}
exit(0);
}
+#if defined(HAVE_OPENDIR) && defined(HAVE_READDIR) && defined(HAVE_CHDIR)
if (argc>1 && strcmp("cd", argv[1]) == 0){
if (argc>3){
printf("ERROR: invalid parameter count for cd\n");
return(0);
}
-#ifndef WIN32
+#if ! defined(HAVE_CHROOT) || ! defined(HAVE_GETUID)
if (getuid()==0 && ! ChangeRoot){
printf("ERROR: chdir security problem - rrdtool is runnig as "
"root an no chroot!\n");
printf("ERROR: invalid parameter count for mkdir\n");
return(0);
}
-#ifndef WIN32
+#if ! defined(HAVE_CHROOT) || ! defined(HAVE_GETUID)
if (getuid()==0 && ! ChangeRoot){
printf("ERROR: mkdir security problem - rrdtool is runnig as "
"root an no chroot!\n");
}
return(0);
}
+#endif /* opendir and readdir */
+
}
if (argc < 3
|| strcmp("help", argv[1]) == 0
}
} else if (strcmp("xport", argv[1]) == 0) {
int xxsize;
- int i = 0, j = 0;
+ unsigned long int i = 0, j = 0;
time_t start,end;
unsigned long step, col_cnt,row_cnt;
rrd_value_t *data,*ptr;