diff -r 1e46ce84435a -r e5faec28ec63 mrtg/mrtg.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mrtg/mrtg.patch Thu Oct 04 20:08:55 2012 +0200 @@ -0,0 +1,75 @@ +--- src/rateup.c.orig 2011-12-01 17:06:48.000000000 +0100 ++++ src/rateup.c 2011-02-20 23:33:38.000000000 +0100 +@@ -115,6 +115,7 @@ + char *longup = NULL; + char *shortup = NULL; + char *pngtitle = NULL; ++char *pngdate = NULL; + char *rtimezone = NULL; + char weekformat = 'V'; /* strftime() fmt char for week # */ + +@@ -487,21 +488,13 @@ + { + short_si_out = kMG; + kMGnumber = 0; ++ short_si[0] = kMG; + while ((short_si_out = strchr (short_si_out, ',')) != NULL) + { ++ short_si_out[0] = '\0'; + short_si_out++; +- kMGnumber++; ++ short_si[++kMGnumber] = short_si_out; + } +- short_si = calloc(kMGnumber + 1, sizeof(*short_si)); +- short_si_out = kMG; +- for (kMGnumber = 0; ; kMGnumber++) +- { +- short_si[kMGnumber] = short_si_out; +- short_si_out = strchr(short_si_out, ','); +- if (short_si_out == NULL) break; +- short_si_out[0] = '\0'; +- short_si_out++; +- } + } + } + +@@ -1115,9 +1108,9 @@ + currdatetimepos_x, currdatetimepos_y, + (unsigned char *)currdatetimestr, i_grid); + } +- +- snprintf(file_tmp,1000,"%s.tmp_%lu",file,(unsigned long)getpid()); +- ++ file_tmp[0]=0; ++ strncat(file_tmp,file,1000); ++ strncat(file_tmp,".tmp",1000); + if ((fo = fopen (file_tmp, "wb")) == NULL) + { + perror (program); +@@ -1132,9 +1125,6 @@ + gdImageDestroy (brush_outp); + free (lhist); + free (graph_label); +- if (kMG) +- free(short_si); +- + + #ifdef WIN32 + /* got to remove the target under win32 +@@ -1402,7 +1392,7 @@ + (unsigned long) now); + return; + } +- sprintf (buf, "%s.tmp_%lu", router,(unsigned long)getpid()); ++ sprintf (buf, "%s.tmp", router); + sprintf (buf1, "%s.log", router); + sprintf (buf2, "%s.old", router); + if ((lhist = calloc (1, sizeof (struct HISTORY) * (MAX_HISTORY + 1))) == +@@ -1802,7 +1792,6 @@ + if (!(cbuf = fread (buff, 1, LENGTH_OF_BUFF, fp))) + { + fprintf (stderr, "%s, %s ERROR: Parameters file empty\n", bufftime, program); +- fclose(fp); + return (1); + } + fclose (fp);