]> git.pld-linux.org Git - packages/squid.git/commitdiff
- try to deal with misalignments
authorJakub Bogusz <qboosh@pld-linux.org>
Fri, 4 Mar 2005 22:15:10 +0000 (22:15 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    squid-align.patch -> 1.1

squid-align.patch [new file with mode: 0644]

diff --git a/squid-align.patch b/squid-align.patch
new file mode 100644 (file)
index 0000000..4e4a6c7
--- /dev/null
@@ -0,0 +1,30 @@
+--- squid-2.5.STABLE8/src/pinger.c.orig        2003-12-23 01:55:57.000000000 +0100
++++ squid-2.5.STABLE8/src/pinger.c     2005-03-04 23:13:15.000000000 +0100
+@@ -169,7 +169,7 @@
+     icmp->icmp_seq = (u_short) icmp_pkts_sent++;
+     echo = (icmpEchoData *) (icmp + 1);
+     echo->opcode = (unsigned char) opcode;
+-    echo->tv = current_time;
++    memcpy(&(echo->tv), &current_time, sizeof(struct timeval)); /* misaligned on archs with 64-bit time_t */
+     icmp_pktsize += sizeof(struct timeval) + sizeof(char);
+     if (payload) {
+       if (len > MAX_PAYLOAD)
+@@ -204,7 +204,7 @@
+     struct iphdr *ip = NULL;
+     struct icmphdr *icmp = NULL;
+     static char *pkt = NULL;
+-    struct timeval now;
++    struct timeval now, pkttv;
+     icmpEchoData *echo;
+     static pingerReplyData preply;
+@@ -242,7 +242,8 @@
+     preply.from = from.sin_addr;
+     preply.opcode = echo->opcode;
+     preply.hops = ipHops(ip->ip_ttl);
+-    preply.rtt = tvSubMsec(echo->tv, now);
++    memcpy(&pkttv, &(echo->tv), sizeof(struct timeval)); /* possibly misaligned */
++    preply.rtt = tvSubMsec(pkttv, now);
+     preply.psize = n - iphdrlen - (sizeof(icmpEchoData) - MAX_PKT_SZ);
+     pingerSendtoSquid(&preply);
+     pingerLog(icmp, from.sin_addr, preply.rtt, preply.hops);
This page took 0.106451 seconds and 4 git commands to generate.