projects
/
rrdtool.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
improved dist target -- Peter Stamfest <peter@stamfest.at>
[rrdtool.git]
/
src
/
rrd_tool.c
diff --git
a/src/rrd_tool.c
b/src/rrd_tool.c
index
41cf3cd
..
c424355
100644
(file)
--- a/
src/rrd_tool.c
+++ b/
src/rrd_tool.c
@@
-253,7
+253,9
@@
int main(int argc, char *argv[])
{
char **myargv;
char aLine[MAX_LENGTH];
{
char **myargv;
char aLine[MAX_LENGTH];
+#ifdef HAVE_CHROOT
char *firstdir="";
char *firstdir="";
+#endif
#ifdef MUST_DISABLE_SIGFPE
signal(SIGFPE,SIG_IGN);
#endif
#ifdef MUST_DISABLE_SIGFPE
signal(SIGFPE,SIG_IGN);
#endif
@@
-279,7
+281,7
@@
int main(int argc, char *argv[])
gettimeofday(&starttime,&tz);
#endif
RemoteMode=1;
gettimeofday(&starttime,&tz);
#endif
RemoteMode=1;
-#if
ndef WIN32
+#if
def HAVE_CHROOT
if ((argc == 3) && strcmp("",argv[2])){
if (getuid()==0){
chroot(argv[2]);
if ((argc == 3) && strcmp("",argv[2])){
if (getuid()==0){
chroot(argv[2]);
@@
-303,8
+305,8
@@
int main(int argc, char *argv[])
}
}
#else
}
}
#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(1);
#endif
@@
-360,9
+362,13
@@
int main(int argc, char *argv[])
int HandleInputLine(int argc, char **argv, FILE* out)
{
int HandleInputLine(int argc, char **argv, FILE* out)
{
+#if defined(HAVE_OPENDIR) && defined (HAVE_READDIR)
DIR *curdir; /* to read current dir with ls */
struct dirent *dent;
DIR *curdir; /* to read current dir with ls */
struct dirent *dent;
+#endif
+#if defined(HAVE_SYS_STAT_H)
struct stat st;
struct stat st;
+#endif
optind=0; /* reset gnu getopt */
opterr=0; /* no error messages */
optind=0; /* reset gnu getopt */
opterr=0; /* no error messages */
@@
-374,12
+380,13
@@
int HandleInputLine(int argc, char **argv, FILE* out)
}
exit(0);
}
}
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);
}
if (argc>1 && strcmp("cd", argv[1]) == 0){
if (argc>3){
printf("ERROR: invalid parameter count for cd\n");
return(0);
}
-#if
ndef 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");
if (getuid()==0 && ! ChangeRoot){
printf("ERROR: chdir security problem - rrdtool is runnig as "
"root an no chroot!\n");
@@
-397,7
+404,7
@@
int HandleInputLine(int argc, char **argv, FILE* out)
printf("ERROR: invalid parameter count for mkdir\n");
return(0);
}
printf("ERROR: invalid parameter count for mkdir\n");
return(0);
}
-#if
ndef 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");
if (getuid()==0 && ! ChangeRoot){
printf("ERROR: mkdir security problem - rrdtool is runnig as "
"root an no chroot!\n");
@@
-422,8
+429,8
@@
int HandleInputLine(int argc, char **argv, FILE* out)
printf("d %s\n",dent->d_name);
}
if (strlen(dent->d_name)>4 && S_ISREG(st.st_mode)){
printf("d %s\n",dent->d_name);
}
if (strlen(dent->d_name)>4 && S_ISREG(st.st_mode)){
- if (!strcmp(dent->d_name+
strlen(dent->d_name
)-4,".rrd") ||
- !strcmp(dent->d_name+
strlen(dent->d_name
)-4,".RRD")){
+ if (!strcmp(dent->d_name+
NAMLEN(dent
)-4,".rrd") ||
+ !strcmp(dent->d_name+
NAMLEN(dent
)-4,".RRD")){
printf("- %s\n",dent->d_name);
}
}
printf("- %s\n",dent->d_name);
}
}
@@
-436,6
+443,8
@@
int HandleInputLine(int argc, char **argv, FILE* out)
}
return(0);
}
}
return(0);
}
+#endif /* opendir and readdir */
+
}
if (argc < 3
|| strcmp("help", argv[1]) == 0
}
if (argc < 3
|| strcmp("help", argv[1]) == 0
@@
-519,7
+528,7
@@
int HandleInputLine(int argc, char **argv, FILE* out)
}
} else if (strcmp("xport", argv[1]) == 0) {
int xxsize;
}
} 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;
time_t start,end;
unsigned long step, col_cnt,row_cnt;
rrd_value_t *data,*ptr;