On Mon, Mar 14, 2016 at 09:22:15AM +0100, Lukas Slebodnik wrote:
> ehlo,
> 
> attached patch fix coverity error.
> 
> LS

> From 26fc8459b84d90fa3f1ac35eb018257285f6a1d7 Mon Sep 17 00:00:00 2001
> From: Lukas Slebodnik <lsleb...@redhat.com>
> Date: Mon, 14 Mar 2016 09:15:06 +0100
> Subject: [PATCH] UTIL: Do not call stderr with negative number
> 
> The function connect return -1 in case of error
> and we could call strerror with -1 instead of
> errno.
> ---
>  src/util/sss_sockets.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/src/util/sss_sockets.c b/src/util/sss_sockets.c
> index 
> ae259fae4db1068d54487ebfa28d00c00eb6361f..4c870c7889c52ff6c1e7c8f6e73827e2a0d05d0a
>  100644
> --- a/src/util/sss_sockets.c
> +++ b/src/util/sss_sockets.c
> @@ -180,9 +180,11 @@ static void sssd_async_connect_done(struct 
> tevent_context *ev,
>      errno = 0;
>      ret = connect(state->fd, (struct sockaddr *) &state->addr,
>                    state->addr_len);
> -    if ((ret != EOK) &&
> -        (errno == EALREADY || errno == EINPROGRESS || errno == EINTR)) {
> -        return; /* Try again later */
> +    if (ret != EOK) {

Nitpick, but can you test against 0 and not EOK here?

Coverity confirmed that the negative return issue went away and CI also
passed:
    http://sssd-ci.duckdns.org/logs/job/39/25/summary.html

> +        ret = errno;
> +        if (ret == EALREADY || ret == EINPROGRESS || ret == EINTR) {
> +            return; /* Try again later */
> +        }
>      }
>  
>      talloc_zfree(fde);
> -- 
> 2.7.2
> 

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/sssd-devel@lists.fedorahosted.org

Reply via email to