Code

Added upstream patch bts496847-error-handling.
authorSebastian Harl <sh@tokkee.org>
Sat, 20 Sep 2008 19:56:56 +0000 (21:56 +0200)
committerSebastian Harl <sh@tokkee.org>
Sat, 20 Sep 2008 19:56:56 +0000 (21:56 +0200)
This fixes error handling of syscalls in rrdtool(1).

Closes: #496847
debian/changelog
debian/patches/bts496847-error-handling [new file with mode: 0644]
debian/patches/series

index c808f3ff50bcc02224e88e54ca539c8cb1b4be1a..f7cc2964704dcb08ff7b85a03d021b3b55fc4212 100644 (file)
@@ -6,8 +6,10 @@ rrdtool (1.3.1-4) unstable; urgency=low
     - Added bts498183-segfault-madvise to fix a segfault on sparc caused by a
       wrong argument passed to madvise(2) - thanks to Jurij Smakov for
       valuable debugging information (Closes: #498183).
+    - Added upstream patch bts496847-error-handling to fix error handling of
+      syscalls in rrdtool(1) (Closes: #496847).
 
- -- Sebastian Harl <sh@tokkee.org>  Sat, 20 Sep 2008 21:03:05 +0200
+ -- Sebastian Harl <sh@tokkee.org>  Sat, 20 Sep 2008 21:50:18 +0200
 
 rrdtool (1.3.1-3) unstable; urgency=low
 
diff --git a/debian/patches/bts496847-error-handling b/debian/patches/bts496847-error-handling
new file mode 100644 (file)
index 0000000..34fc0c2
--- /dev/null
@@ -0,0 +1,79 @@
+diff a/src/rrd_tool.c b/src/rrd_tool.c
+--- a/src/rrd_tool.c
++++ b/src/rrd_tool.c
+@@ -424,11 +424,8 @@ int main(
+                    == 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;
+@@ -444,9 +441,8 @@ int main(
+             }
+         }
+         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);
+             }
+         }
+@@ -520,7 +516,6 @@ int HandleInputLine(
+     /* Reset errno to 0 before we start.
+      */
+-    errno = 0;
+     if (RemoteMode) {
+         if (argc > 1 && strcmp("quit", argv[1]) == 0) {
+             if (argc > 2) {
+@@ -543,9 +538,8 @@ int HandleInputLine(
+                 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);
+@@ -557,7 +551,7 @@ int HandleInputLine(
+             }
+             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);
+@@ -577,9 +571,8 @@ int HandleInputLine(
+                 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);
+@@ -607,7 +600,7 @@ int HandleInputLine(
+                 }
+                 closedir(curdir);
+             } else {
+-                printf("ERROR: %s\n", rrd_strerror(errno));
++                printf("ERROR: opendir .: %s\n", rrd_strerror(errno));
+                 return (errno);
+             }
+             return (0);
index 385c5ed2145eabf012412d5c1fc29f114d092440..5a746d01cc49975882af1a4f9baff0a5432450e9 100644 (file)
@@ -6,3 +6,4 @@ no-rpath-for-perl
 implicit-decl-fix
 bts499350-data-corruption
 bts498183-segfault-madvise
+bts496847-error-handling