From 5580928bd2ce5f144ebbe8e86352d84587b63a3e Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Mon, 1 Jun 2009 12:55:30 +0200 Subject: [PATCH] patches: Added bts530814-hurd. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch fixes a FTBFS on Hurd. Thanks to Marc Dequènes for reporting this and providing a patch. Closes: #530814 --- debian/changelog | 5 ++- debian/patches/bts530814-hurd | 69 +++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 debian/patches/bts530814-hurd diff --git a/debian/changelog b/debian/changelog index c5c3262..7dbaa62 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,11 @@ rrdtool (1.3.8-1) unstable; urgency=low * New upstream release: - Fixed various memory leaks in the Python bindings, thanks to Anders Hammarquist for reporting this and providing a patch (Closes: #529291). + * debian/patches: + - Added bts530814-hurd to fix a FTBFS on Hurd, thanks to Marc Dequènes for + reporting this and providing a patch (Closes: #530814). - -- Sebastian Harl Mon, 01 Jun 2009 12:32:13 +0200 + -- Sebastian Harl Mon, 01 Jun 2009 12:52:15 +0200 rrdtool (1.3.7-1) unstable; urgency=low diff --git a/debian/patches/bts530814-hurd b/debian/patches/bts530814-hurd new file mode 100644 index 0000000..8e8941d --- /dev/null +++ b/debian/patches/bts530814-hurd @@ -0,0 +1,69 @@ +diff a/src/rrd_graph.c /src/rrd_graph.c +--- a/src/rrd_graph.c ++++ b/src/rrd_graph.c +@@ -3697,6 +3697,7 @@ + image_desc_t im; + rrd_info_t *grinfo; + rrd_graph_init(&im); ++ size_t graphfile_len; + /* a dummy surface so that we can measure text sizes for placements */ + + rrd_graph_options(argc, argv, &im); +@@ -3713,7 +3714,9 @@ + return NULL; + } + +- if (strlen(argv[optind]) >= MAXPATH) { ++ graphfile_len = strlen(argv[optind]); ++#ifdef MAXPATH ++ if (graphfile_len >= MAXPATH) { + rrd_set_error("filename (including path) too long"); + rrd_info_free(im.grinfo); + im_free(&im); +@@ -3722,6 +3725,16 @@ + + strncpy(im.graphfile, argv[optind], MAXPATH - 1); + im.graphfile[MAXPATH - 1] = '\0'; ++#else ++ im.graphfile = malloc(graphfile_len + 1); ++ if (im.graphfile == NULL) { ++ rrd_set_error("cannot allocate sufficient memory for filename length"); ++ rrd_info_free(im.grinfo); ++ im_free(&im); ++ return NULL; ++ } ++ strncpy(im.graphfile, argv[optind], graphfile_len + 1); ++#endif + + if (strcmp(im.graphfile, "-") == 0) { + im.graphfile[0] = '\0'; +diff a/src/rrd_graph.h b/src/rrd_graph.h +--- a/src/rrd_graph.h ++++ b/src/rrd_graph.h +@@ -196,7 +196,11 @@ + + /* configuration of graph */ + ++#ifdef MAXPATH + char graphfile[MAXPATH]; /* filename for graphic */ ++#else ++ char *graphfile; /* filename for graphic */ ++#endif + long xsize, ysize; /* graph area size in pixels */ + struct gfx_color_t graph_col[__GRC_END__]; /* real colors for the graph */ + text_prop_t text_prop[TEXT_PROP_LAST]; /* text properties */ +diff a/src/rrd_tool.c b/src/rrd_tool.c +--- a/src/rrd_tool.c ++++ b/src/rrd_tool.c +@@ -555,7 +555,11 @@ + printf("ERROR: invalid parameter count for pwd\n"); + return (1); + } ++#ifdef __GLIBC__ ++ cwd = get_current_dir_name(); ++#else + cwd = getcwd(NULL, MAXPATH); ++#endif + if (cwd == NULL) { + printf("ERROR: getcwd %s\n", rrd_strerror(errno)); + return (1); diff --git a/debian/patches/series b/debian/patches/series index ae66800..7eb25d9 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -6,3 +6,4 @@ no-rpath-for-perl implicit-decl-fix compiler-warning-fixes doc-fixes +bts530814-hurd -- 2.30.2