The branch main has been updated by pfg: URL: https://cgit.FreeBSD.org/src/commit/?id=c384a27805a630ae45ca3d97614a07ebfce5515d
commit c384a27805a630ae45ca3d97614a07ebfce5515d Author: Pedro F. Giffuni <p...@freebsd.org> AuthorDate: 2021-07-22 19:09:17 +0000 Commit: Pedro F. Giffuni <p...@freebsd.org> CommitDate: 2021-07-22 19:23:22 +0000 patch: cleanup variable initialization a bit. musl libc fgetln is a bit more pickier. Hinted by: chimera-linux (git 31491e1de2e1241885984cd9e4b978965f14eda4) --- usr.bin/patch/inp.c | 4 +++- usr.bin/patch/pch.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.bin/patch/inp.c b/usr.bin/patch/inp.c index 6a01f782ce62..99be70957f06 100644 --- a/usr.bin/patch/inp.c +++ b/usr.bin/patch/inp.c @@ -284,7 +284,7 @@ static void plan_b(const char *filename) { FILE *ifp; - size_t i = 0, j, len, maxlen = 1; + size_t i, j, len, maxlen; char *lbuf = NULL, *p; bool found_revision = (revision == NULL); @@ -294,6 +294,8 @@ plan_b(const char *filename) unlink(TMPINNAME); if ((tifd = open(TMPINNAME, O_EXCL | O_CREAT | O_WRONLY, 0666)) < 0) pfatal("can't open file %s", TMPINNAME); + len = 0; + maxlen = 1; while ((p = fgetln(ifp, &len)) != NULL) { if (p[len - 1] == '\n') p[len - 1] = '\0'; diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c index 70051640cf0c..d1d71f95644c 100644 --- a/usr.bin/patch/pch.c +++ b/usr.bin/patch/pch.c @@ -1215,7 +1215,7 @@ size_t pgets(bool do_indent) { char *line; - size_t len; + size_t len = 0; int indent = 0, skipped = 0; line = fgetln(pfp, &len); _______________________________________________ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"