From ef12c36e624a19e3a16f20070247d9a726e7b766 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 30 May 2015 18:12:14 +0000 Subject: Tentatively fix a few libfetch warnings, see this review for the details: https://reviews.freebsd.org/D2673 --- lib/libfetch/http.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'lib/libfetch/http.c') diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index ad4a41952151..e0c297971a36 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -1625,10 +1625,8 @@ http_request_body(struct url *URL, const char *op, struct url_stat *us, http_auth_params_t aparams; init_http_auth_params(&aparams); if (*purl->user || *purl->pwd) { - aparams.user = purl->user ? - strdup(purl->user) : strdup(""); - aparams.password = purl->pwd? - strdup(purl->pwd) : strdup(""); + aparams.user = strdup(purl->user); + aparams.password = strdup(purl->pwd); } else if ((p = getenv("HTTP_PROXY_AUTH")) != NULL && *p != '\0') { if (http_authfromenv(p, &aparams) < 0) { @@ -1654,10 +1652,8 @@ http_request_body(struct url *URL, const char *op, struct url_stat *us, http_auth_params_t aparams; init_http_auth_params(&aparams); if (*url->user || *url->pwd) { - aparams.user = url->user ? - strdup(url->user) : strdup(""); - aparams.password = url->pwd ? - strdup(url->pwd) : strdup(""); + aparams.user = strdup(url->user); + aparams.password = strdup(url->pwd); } else if ((p = getenv("HTTP_AUTH")) != NULL && *p != '\0') { if (http_authfromenv(p, &aparams) < 0) { @@ -1666,10 +1662,8 @@ http_request_body(struct url *URL, const char *op, struct url_stat *us, } } else if (fetchAuthMethod && fetchAuthMethod(url) == 0) { - aparams.user = url->user ? - strdup(url->user) : strdup(""); - aparams.password = url->pwd ? - strdup(url->pwd) : strdup(""); + aparams.user = strdup(url->user); + aparams.password = strdup(url->pwd); } else { http_seterr(HTTP_NEED_AUTH); goto ouch; -- cgit v1.2.3