summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bbe65af)
raw | patch | inline | side by side (parent: bbe65af)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 28 Aug 2008 05:49:02 +0000 (05:49 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 28 Aug 2008 05:49:02 +0000 (05:49 +0000) |
program/src/rrd_tool.c | patch | blob | history |
diff --git a/program/src/rrd_tool.c b/program/src/rrd_tool.c
index d08d7de74c7d5d6d9a27f073f10ac2461986d804..b6cc65bc1decf1c959fb2d39c6094ee7f5988604 100644 (file)
--- a/program/src/rrd_tool.c
+++ b/program/src/rrd_tool.c
== 0) {
#ifdef HAVE_CHROOT
- chroot(argv[2]);
- if (errno != 0) {
- fprintf(stderr,
- "ERROR: can't change root to '%s' errno=%d\n",
- argv[2], errno);
+ if (chroot(argv[2]) != 0){
+ fprintf(stderr, "ERROR: chroot %s: %s\n", argv[2],rrd_strerror(errno));
exit(errno);
}
ChangeRoot = 1;
}
}
if (strcmp(firstdir, "")) {
- chdir(firstdir);
- if (errno != 0) {
- fprintf(stderr, "ERROR: %s\n", rrd_strerror(errno));
+ if (chdir(firstdir) != 0){
+ fprintf(stderr, "ERROR: chdir %s %s\n", firstdir,rrd_strerror(errno));
exit(errno);
}
}
/* Reset errno to 0 before we start.
*/
- errno = 0;
if (RemoteMode) {
if (argc > 1 && strcmp("quit", argv[1]) == 0) {
if (argc > 2) {
return (1);
}
#endif
- chdir(argv[2]);
- if (errno != 0) {
- printf("ERROR: %s\n", rrd_strerror(errno));
+ if (chdir(argv[2]) != 0){
+ printf("ERROR: chdir %s %s\n", argv[2], rrd_strerror(errno));
return (1);
}
return (0);
}
cwd = getcwd(NULL, MAXPATH);
if (cwd == NULL) {
- printf("ERROR: %s\n", rrd_strerror(errno));
+ printf("ERROR: getcwd %s\n", rrd_strerror(errno));
return (1);
}
printf("%s\n", cwd);
return (1);
}
#endif
- mkdir(argv[2], 0777);
- if (errno != 0) {
- printf("ERROR: %s\n", rrd_strerror(errno));
+ if(mkdir(argv[2], 0777)!=0){
+ printf("ERROR: mkdir %s: %s\n", argv[2],rrd_strerror(errno));
return (1);
}
return (0);
}
closedir(curdir);
} else {
- printf("ERROR: %s\n", rrd_strerror(errno));
+ printf("ERROR: opendir .: %s\n", rrd_strerror(errno));
return (errno);
}
return (0);