summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorNick Leverton <nick@leverton.org>2010-07-20 08:58:01 +0200
committerPeter Korsgaard <jacmet@sunsite.dk>2010-07-20 08:59:36 +0200
commit6c387f2e691293df096349af0f08c071d6f21a65 (patch)
tree779964ca0945db0d20f84092739a414a769ebfdb /package
parentc9ff3273eb94078ad342d0a3e08e1757bced2afa (diff)
netcat: fix logic for archs with unsigned chars
Closes #2245 Signed-off-by: Nick Leverton <nick@leverton.org> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'package')
-rw-r--r--package/netcat/netcat-0.7.1-signed-bit-counting.patch30
1 files changed, 30 insertions, 0 deletions
diff --git a/package/netcat/netcat-0.7.1-signed-bit-counting.patch b/package/netcat/netcat-0.7.1-signed-bit-counting.patch
new file mode 100644
index 000000000..e29da311a
--- /dev/null
+++ b/package/netcat/netcat-0.7.1-signed-bit-counting.patch
@@ -0,0 +1,30 @@
+# Fix the endian-specific bit-counting code so that it works.
+# SF:1068324 "netcat_flag_count() fix"
+# http://sourceforge.net/tracker/?func=detail&aid=1205729&group_id=52204&atid=466046
+# SF:1205729 "doen't work on arm linux platform":
+# http://sourceforge.net/tracker/?func=detail&aid=1068324&group_id=52204&atid=466046
+
+Index: netcat-0.7.1/src/flagset.c
+===================================================================
+--- netcat-0.7.1.orig/src/flagset.c 2010-07-19 13:51:46.000000000 +0100
++++ netcat-0.7.1/src/flagset.c 2010-07-19 13:52:27.000000000 +0100
+@@ -134,7 +134,7 @@
+
+ int netcat_flag_count(void)
+ {
+- register char c;
++ register unsigned char c;
+ register int i;
+ int ret = 0;
+
+@@ -154,8 +154,8 @@
+ Assumed that the bit number 1 is the sign, and that we will shift the
+ bit 1 (or the bit that takes its place later) until the the most right,
+ WHY it has to keep the wrong sign? */
+- ret -= (c >> 7);
+- c <<= 1;
++ ret += c&1;
++ c>>=1;
+ }
+ }
+