git: 08a2504a207c - main - fetch(1): fix error in previous commit
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 24 Jan 2022 08:13:15 UTC
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) {