summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 07a13ae)
raw | patch | inline | side by side (parent: 07a13ae)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 14 May 2002 05:28:45 +0000 (05:28 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 14 May 2002 05:28:45 +0000 (05:28 +0000) |
a conditional compile depending on the presence of the necessary function calls.
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@138 a5681a0c-68f1-0310-ab6d-d61299d08faa
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@138 a5681a0c-68f1-0310-ab6d-d61299d08faa
configure.ac | patch | blob | history | |
src/rrd_tool.c | patch | blob | history |
diff --git a/configure.ac b/configure.ac
index 9c9fe258818ef1f9d539b35125f180d0672c1c64..ae599bc15710ab3de77ad01780d79468c4fadc20 100644 (file)
--- a/configure.ac
+++ b/configure.ac
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, ,
diff --git a/src/rrd_tool.c b/src/rrd_tool.c
index 4a6c8cd75938ace45b41daffafcdb5b861d8d177..729652603e6a42319d5b8c8b5efb9100463e8d82 100644 (file)
--- a/src/rrd_tool.c
+++ b/src/rrd_tool.c
{
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;