Fix some issues found by 'infer'

This commit is contained in:
Tim Rühsen 2018-03-14 14:43:35 +01:00
parent 0b54043d17
commit f56f970bc2
2 changed files with 10 additions and 15 deletions

View File

@ -57,7 +57,7 @@ as that of the covered work. */
uerr_t
ftp_response (int fd, char **ret_line)
{
while (1)
for (;;)
{
char *p;
char *line = fd_read_line (fd);
@ -65,12 +65,9 @@ ftp_response (int fd, char **ret_line)
return FTPRERR;
/* Strip trailing CRLF before printing the line, so that
quotting doesn't include bogus \012 and \015. */
p = strchr (line, '\0');
if (p > line && p[-1] == '\n')
*--p = '\0';
if (p > line && p[-1] == '\r')
*--p = '\0';
quoting doesn't include bogus \012 and \015. */
if ((p = strpbrk(line , "\r\n")))
*p = 0;
if (opt.server_response)
logprintf (LOG_NOTQUIET, "%s\n",

View File

@ -99,8 +99,8 @@ retrieve_from_metalink (const metalink_t* metalink)
metalink_resource_t **mres_ptr;
char *planname = NULL;
char *trsrname = NULL;
char *filename = NULL;
char *basename = NULL;
char *filename;
char *basename;
char *safename = NULL;
char *destname = NULL;
bool size_ok = false;
@ -709,8 +709,7 @@ retrieve_from_metalink (const metalink_t* metalink)
gpgme_data_t gpgsigdata, gpgdata;
gpgme_verify_result_t gpgres;
gpgme_signature_t gpgsig;
gpgme_protocol_t gpgprot = GPGME_PROTOCOL_UNKNOWN;
int fd = -1;
int fd;
/* Initialize the library - as name suggests. */
gpgme_check_version (NULL);
@ -751,16 +750,15 @@ retrieve_from_metalink (const metalink_t* metalink)
msig->signature));
/* Check signature type. */
if (!strcmp (msig->mediatype, "application/pgp-signature"))
gpgprot = GPGME_PROTOCOL_OpenPGP;
else /* Unsupported signature type. */
if (strcmp (msig->mediatype, "application/pgp-signature"))
{
/* Unsupported signature type. */
gpgme_release (gpgctx);
gpgme_data_release (gpgdata);
goto gpg_skip_verification;
}
gpgerr = gpgme_set_protocol (gpgctx, gpgprot);
gpgerr = gpgme_set_protocol (gpgctx, GPGME_PROTOCOL_OpenPGP);
if (gpgerr != GPG_ERR_NO_ERROR)
{
logprintf (LOG_NOTQUIET,