void-packages/srcpkgs/netcat/patches/netcat-0.7.1-signed-bit-counting.patch
Đoàn Trần Công Danh 65749575ab srcpkgs/n*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

28 lines
871 B
Diff

# 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
--- a/src/flagset.c 2010-07-19 13:51:46.000000000 +0100
+++ b/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;
}
}