summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 93b5bc5)
raw | patch | inline | side by side (parent: 93b5bc5)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Fri, 22 Jul 2005 13:16:48 +0000 (13:16 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Fri, 22 Jul 2005 13:16:48 +0000 (13:16 +0000) |
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@660 a5681a0c-68f1-0310-ab6d-d61299d08faa
src/rrd_tool.c | patch | blob | history |
diff --git a/src/rrd_tool.c b/src/rrd_tool.c
index cdd78887145d677f7e6e4a6893cbc53ce4a2f4a8..65e411e1202d5ba218e1b705108bf294c2a7b5c5 100644 (file)
--- a/src/rrd_tool.c
+++ b/src/rrd_tool.c
exit(1);
}
if ((argc=CreateArgs(argv[0], aLine, argc, myargv)) < 0) {
- fprintf(stderr, "ERROR: creating arguments\n");
- exit(1);
- }
-
- HandleInputLine(argc, myargv, stdout);
- free(myargv);
+ printf("ERROR: creating arguments\n");
+ } else {
+ int ret = HandleInputLine(argc, myargv, stdout);
+ free(myargv);
+ if (ret == 0){
+
#if HAVE_GETRUSAGE
- getrusage(RUSAGE_SELF,&myusage);
- gettimeofday(¤ttime,&tz);
- printf("OK u:%1.2f s:%1.2f r:%1.2f\n",
+ getrusage(RUSAGE_SELF,&myusage);
+ gettimeofday(¤ttime,&tz);
+ printf("OK u:%1.2f s:%1.2f r:%1.2f\n",
(double)myusage.ru_utime.tv_sec+
(double)myusage.ru_utime.tv_usec/1000000.0,
(double)myusage.ru_stime.tv_sec+
+(double)(currenttime.tv_usec-starttime.tv_usec)
/1000000.0);
#else
- printf("OK\n");
-#endif
+ printf("OK\n");
+
+#endif
+ }
+ }
fflush(stdout); /* this is important for pipes to work */
}
}
if (argc>1 && strcmp("quit", argv[1]) == 0){
if (argc>2){
printf("ERROR: invalid parameter count for quit\n");
- return(0);
+ return(1);
}
exit(0);
}
if (argc>1 && strcmp("cd", argv[1]) == 0){
if (argc>3){
printf("ERROR: invalid parameter count for cd\n");
- return(0);
+ return(1);
}
#if ! defined(HAVE_CHROOT) || ! defined(HAVE_GETUID)
if (getuid()==0 && ! ChangeRoot){
printf("ERROR: chdir security problem - rrdtool is running as "
"root an no chroot!\n");
- return(0);
+ return(1);
}
#endif
chdir(argv[2]);
if (errno!=0){
printf("ERROR: %s\n",rrd_strerror(errno));
+ return(1);
}
return(0);
}
if (argc>1 && strcmp("mkdir", argv[1]) == 0){
if (argc>3){
printf("ERROR: invalid parameter count for mkdir\n");
- return(0);
+ return(1);
}
#if ! defined(HAVE_CHROOT) || ! defined(HAVE_GETUID)
if (getuid()==0 && ! ChangeRoot){
printf("ERROR: mkdir security problem - rrdtool is running as "
"root an no chroot!\n");
- return(0);
+ return(1);
}
#endif
mkdir(argv[2],0777);
if (errno!=0){
printf("ERROR: %s\n",rrd_strerror(errno));
+ return(1);
}
return(0);
}
if (argc>1 && strcmp("ls", argv[1]) == 0){
if (argc>2){
printf("ERROR: invalid parameter count for ls\n");
- return(0);
+ return(1);
}
if ((curdir=opendir("."))!=NULL){
while((dent=readdir(curdir))!=NULL){