mrtg/mrtg.patch

changeset 711
e5faec28ec63
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mrtg/mrtg.patch	Thu Oct 04 20:08:55 2012 +0200
     1.3 @@ -0,0 +1,75 @@
     1.4 +--- src/rateup.c.orig	2011-12-01 17:06:48.000000000 +0100
     1.5 ++++ src/rateup.c	2011-02-20 23:33:38.000000000 +0100
     1.6 +@@ -115,6 +115,7 @@
     1.7 + char *longup = NULL;
     1.8 + char *shortup = NULL;
     1.9 + char *pngtitle = NULL;
    1.10 ++char *pngdate = NULL;
    1.11 + char *rtimezone = NULL;
    1.12 + char weekformat = 'V';		/* strftime() fmt char for week #  */
    1.13 + 
    1.14 +@@ -487,21 +488,13 @@
    1.15 +         {
    1.16 +           short_si_out = kMG;
    1.17 +           kMGnumber = 0;
    1.18 ++	  short_si[0] = kMG;
    1.19 +           while ((short_si_out = strchr (short_si_out, ',')) != NULL)
    1.20 + 	    {
    1.21 ++	      short_si_out[0] = '\0';
    1.22 + 	      short_si_out++;
    1.23 +-              kMGnumber++;
    1.24 ++              short_si[++kMGnumber] = short_si_out;
    1.25 + 	    }
    1.26 +-          short_si = calloc(kMGnumber + 1, sizeof(*short_si));
    1.27 +-          short_si_out = kMG;
    1.28 +-          for (kMGnumber = 0; ; kMGnumber++)
    1.29 +-            {
    1.30 +-              short_si[kMGnumber] = short_si_out;
    1.31 +-             short_si_out = strchr(short_si_out, ',');
    1.32 +-              if (short_si_out == NULL) break;
    1.33 +-              short_si_out[0] = '\0';
    1.34 +-              short_si_out++;
    1.35 +-            }
    1.36 +         }
    1.37 +      }
    1.38 +   
    1.39 +@@ -1115,9 +1108,9 @@
    1.40 + 		     currdatetimepos_x, currdatetimepos_y,
    1.41 + 		     (unsigned char *)currdatetimestr, i_grid);
    1.42 +     }
    1.43 +-
    1.44 +-  snprintf(file_tmp,1000,"%s.tmp_%lu",file,(unsigned long)getpid());
    1.45 +-
    1.46 ++  file_tmp[0]=0;
    1.47 ++  strncat(file_tmp,file,1000);
    1.48 ++  strncat(file_tmp,".tmp",1000);
    1.49 +   if ((fo = fopen (file_tmp, "wb")) == NULL)
    1.50 +     {
    1.51 +       perror (program);
    1.52 +@@ -1132,9 +1125,6 @@
    1.53 +   gdImageDestroy (brush_outp);
    1.54 +   free (lhist);
    1.55 +   free (graph_label);
    1.56 +-  if (kMG)
    1.57 +-    free(short_si);
    1.58 +-
    1.59 + 
    1.60 + #ifdef WIN32
    1.61 +   /* got to remove the target under win32
    1.62 +@@ -1402,7 +1392,7 @@
    1.63 + 	       (unsigned long) now);
    1.64 +       return;
    1.65 +     }
    1.66 +-  sprintf (buf, "%s.tmp_%lu", router,(unsigned long)getpid());
    1.67 ++  sprintf (buf, "%s.tmp", router);
    1.68 +   sprintf (buf1, "%s.log", router);
    1.69 +   sprintf (buf2, "%s.old", router);
    1.70 +   if ((lhist = calloc (1, sizeof (struct HISTORY) * (MAX_HISTORY + 1))) ==
    1.71 +@@ -1802,7 +1792,6 @@
    1.72 +   if (!(cbuf = fread (buff, 1, LENGTH_OF_BUFF, fp)))
    1.73 +     {
    1.74 +       fprintf (stderr, "%s, %s ERROR: Parameters file empty\n", bufftime, program);
    1.75 +-      fclose(fp);
    1.76 +       return (1);
    1.77 +     }
    1.78 +   fclose (fp);

mercurial