void-packages/srcpkgs/shadow/patches/shadow-strncpy-usage.patch
Đoàn Trần Công Danh 4b97cd2fb4 srcpkgs/s*: 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

23 lines
716 B
Diff

--- a/src/usermod.c 2012-02-13 08:19:43.792146449 -0500
+++ b/src/usermod.c 2012-02-13 08:21:19.375114500 -0500
@@ -182,7 +182,7 @@
struct tm *tp;
if (date < 0) {
- strncpy (buf, "never", maxsize);
+ strncpy (buf, "never", maxsize - 1);
} else {
time_t t = (time_t) date;
tp = gmtime (&t);
--- a/src/login.c 2012-02-13 08:19:50.951994454 -0500
+++ b/src/login.c 2012-02-13 08:21:04.490430937 -0500
@@ -752,7 +752,8 @@
_("%s login: "), hostn);
} else {
strncpy (loginprompt, _("login: "),
- sizeof (loginprompt));
+ sizeof (loginprompt) - 1);
+ loginprompt[sizeof (loginprompt) - 1] = '\0';
}
retcode = pam_set_item (pamh, PAM_USER_PROMPT, loginprompt);