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