Date: Mon, 24 Jan 2022 08:13:15 GMT From: Eugene Grosbein <eugen@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 08a2504a207c - main - fetch(1): fix error in previous commit Message-ID: <202201240813.20O8DFJu051836@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=08a2504a207c9302939bc0d1173fe44875e2a2e4 commit 08a2504a207c9302939bc0d1173fe44875e2a2e4 Author: Eugene Grosbein <eugen@FreeBSD.org> AuthorDate: 2022-01-24 08:07:18 +0000 Commit: Eugene Grosbein <eugen@FreeBSD.org> CommitDate: 2022-01-24 08:07:18 +0000 fetch(1): fix error in previous commit strncmp() compares terminating zero and sizeof() includes it. Un-obsfuscate the code and show what it is indended to do. --- usr.bin/fetch/fetch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c index 55209538e49b..65ba091e3334 100644 --- a/usr.bin/fetch/fetch.c +++ b/usr.bin/fetch/fetch.c @@ -476,7 +476,7 @@ fetch(char *URL, const char *path, int *is_http) } /* for both of http and https */ - *is_http = strncmp(url->scheme, SCHEME_HTTP, sizeof(SCHEME_HTTP)) == 0; + *is_http = strncmp(url->scheme, "http", 4) == 0; /* common flags */ switch (family) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202201240813.20O8DFJu051836>