From b6462901534ae4281e381d40b9bfad228d118d8b Mon Sep 17 00:00:00 2001 From: oetiker Date: Thu, 28 Aug 2008 05:52:39 +0000 Subject: [PATCH] rely on what the function returns. errno is only for informatio not for detection of errors. #176. git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@1472 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/rrd_tool.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/program/src/rrd_tool.c b/program/src/rrd_tool.c index 85269f09..dfd9890f 100644 --- a/program/src/rrd_tool.c +++ b/program/src/rrd_tool.c @@ -379,8 +379,7 @@ int main(int argc, char *argv[]) == 0 ){ #ifdef HAVE_CHROOT - chroot(argv[2]); - if (errno!=0){ + if (chroot(argv[2]) != 0){ fprintf(stderr,"ERROR: can't change root to '%s' errno=%d\n", argv[2],errno); exit(errno); @@ -397,8 +396,7 @@ int main(int argc, char *argv[]) } } if (strcmp(firstdir,"")){ - chdir(firstdir); - if (errno!=0){ + if (chdir(firstdir)!=0){ fprintf(stderr,"ERROR: %s\n",rrd_strerror(errno)); exit(errno); } @@ -496,8 +494,7 @@ int HandleInputLine(int argc, char **argv, FILE* out) return(1); } #endif - chdir(argv[2]); - if (errno!=0){ + if (chdir(argv[2]) != 0){ printf("ERROR: %s\n",rrd_strerror(errno)); return(1); } @@ -529,8 +526,7 @@ int HandleInputLine(int argc, char **argv, FILE* out) return(1); } #endif - mkdir(argv[2],0777); - if (errno!=0){ + if (mkdir(argv[2],0777) != 0){ printf("ERROR: %s\n",rrd_strerror(errno)); return(1); } -- 2.30.2