Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
michael@711 | 1 | --- src/rateup.c.orig 2011-12-01 17:06:48.000000000 +0100 |
michael@711 | 2 | +++ src/rateup.c 2011-02-20 23:33:38.000000000 +0100 |
michael@711 | 3 | @@ -115,6 +115,7 @@ |
michael@711 | 4 | char *longup = NULL; |
michael@711 | 5 | char *shortup = NULL; |
michael@711 | 6 | char *pngtitle = NULL; |
michael@711 | 7 | +char *pngdate = NULL; |
michael@711 | 8 | char *rtimezone = NULL; |
michael@711 | 9 | char weekformat = 'V'; /* strftime() fmt char for week # */ |
michael@711 | 10 | |
michael@711 | 11 | @@ -487,21 +488,13 @@ |
michael@711 | 12 | { |
michael@711 | 13 | short_si_out = kMG; |
michael@711 | 14 | kMGnumber = 0; |
michael@711 | 15 | + short_si[0] = kMG; |
michael@711 | 16 | while ((short_si_out = strchr (short_si_out, ',')) != NULL) |
michael@711 | 17 | { |
michael@711 | 18 | + short_si_out[0] = '\0'; |
michael@711 | 19 | short_si_out++; |
michael@711 | 20 | - kMGnumber++; |
michael@711 | 21 | + short_si[++kMGnumber] = short_si_out; |
michael@711 | 22 | } |
michael@711 | 23 | - short_si = calloc(kMGnumber + 1, sizeof(*short_si)); |
michael@711 | 24 | - short_si_out = kMG; |
michael@711 | 25 | - for (kMGnumber = 0; ; kMGnumber++) |
michael@711 | 26 | - { |
michael@711 | 27 | - short_si[kMGnumber] = short_si_out; |
michael@711 | 28 | - short_si_out = strchr(short_si_out, ','); |
michael@711 | 29 | - if (short_si_out == NULL) break; |
michael@711 | 30 | - short_si_out[0] = '\0'; |
michael@711 | 31 | - short_si_out++; |
michael@711 | 32 | - } |
michael@711 | 33 | } |
michael@711 | 34 | } |
michael@711 | 35 | |
michael@711 | 36 | @@ -1115,9 +1108,9 @@ |
michael@711 | 37 | currdatetimepos_x, currdatetimepos_y, |
michael@711 | 38 | (unsigned char *)currdatetimestr, i_grid); |
michael@711 | 39 | } |
michael@711 | 40 | - |
michael@711 | 41 | - snprintf(file_tmp,1000,"%s.tmp_%lu",file,(unsigned long)getpid()); |
michael@711 | 42 | - |
michael@711 | 43 | + file_tmp[0]=0; |
michael@711 | 44 | + strncat(file_tmp,file,1000); |
michael@711 | 45 | + strncat(file_tmp,".tmp",1000); |
michael@711 | 46 | if ((fo = fopen (file_tmp, "wb")) == NULL) |
michael@711 | 47 | { |
michael@711 | 48 | perror (program); |
michael@711 | 49 | @@ -1132,9 +1125,6 @@ |
michael@711 | 50 | gdImageDestroy (brush_outp); |
michael@711 | 51 | free (lhist); |
michael@711 | 52 | free (graph_label); |
michael@711 | 53 | - if (kMG) |
michael@711 | 54 | - free(short_si); |
michael@711 | 55 | - |
michael@711 | 56 | |
michael@711 | 57 | #ifdef WIN32 |
michael@711 | 58 | /* got to remove the target under win32 |
michael@711 | 59 | @@ -1402,7 +1392,7 @@ |
michael@711 | 60 | (unsigned long) now); |
michael@711 | 61 | return; |
michael@711 | 62 | } |
michael@711 | 63 | - sprintf (buf, "%s.tmp_%lu", router,(unsigned long)getpid()); |
michael@711 | 64 | + sprintf (buf, "%s.tmp", router); |
michael@711 | 65 | sprintf (buf1, "%s.log", router); |
michael@711 | 66 | sprintf (buf2, "%s.old", router); |
michael@711 | 67 | if ((lhist = calloc (1, sizeof (struct HISTORY) * (MAX_HISTORY + 1))) == |
michael@711 | 68 | @@ -1802,7 +1792,6 @@ |
michael@711 | 69 | if (!(cbuf = fread (buff, 1, LENGTH_OF_BUFF, fp))) |
michael@711 | 70 | { |
michael@711 | 71 | fprintf (stderr, "%s, %s ERROR: Parameters file empty\n", bufftime, program); |
michael@711 | 72 | - fclose(fp); |
michael@711 | 73 | return (1); |
michael@711 | 74 | } |
michael@711 | 75 | fclose (fp); |