From b2db129887f28a9af71cca23bd0cfc5823936902 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Sat, 20 Sep 2008 21:56:56 +0200 Subject: [PATCH] Added upstream patch bts496847-error-handling. This fixes error handling of syscalls in rrdtool(1). Closes: #496847 --- debian/changelog | 4 +- debian/patches/bts496847-error-handling | 79 +++++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 debian/patches/bts496847-error-handling diff --git a/debian/changelog b/debian/changelog index c808f3f..f7cc296 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Sat, 20 Sep 2008 21:03:05 +0200 + -- Sebastian Harl 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 index 0000000..34fc0c2 --- /dev/null +++ b/debian/patches/bts496847-error-handling @@ -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); diff --git a/debian/patches/series b/debian/patches/series index 385c5ed..5a746d0 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -6,3 +6,4 @@ no-rpath-for-perl implicit-decl-fix bts499350-data-corruption bts498183-segfault-madvise +bts496847-error-handling -- 2.30.2