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