[PATCH] port-serial: fix gsize/gssize type mismatch

Aleksander Morgado aleksander at aleksander.es
Fri Feb 14 09:06:00 CET 2014


On 13/02/14 21:42, Ben Chan wrote:
> This patch fixes the following type mismatch in MMPortSerial::port_serial_process_command():
> 
> mm-port-serial.c:612:21: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare]
>         if (written < 0) {
>             ~~~~~~~ ^ ~
> ---

Pushed, thanks.

>  src/mm-port-serial.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/src/mm-port-serial.c b/src/mm-port-serial.c
> index 47ce482..e41beef 100644
> --- a/src/mm-port-serial.c
> +++ b/src/mm-port-serial.c
> @@ -606,10 +606,11 @@ port_serial_process_command (MMPortSerial *self,
>      /* Socket based setup */
>      else if (self->priv->socket) {
>          GError *inner_error = NULL;
> +        gssize bytes_sent;
>  
>          /* Send N bytes of the command */
> -        written = g_socket_send (self->priv->socket, p, send_len, NULL, &inner_error);
> -        if (written < 0) {
> +        bytes_sent = g_socket_send (self->priv->socket, p, send_len, NULL, &inner_error);
> +        if (bytes_sent < 0) {
>              /* Non-EWOULDBLOCK error? */
>              if (!g_error_matches (inner_error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) {
>                  g_propagate_error (error, inner_error);
> @@ -634,7 +635,8 @@ port_serial_process_command (MMPortSerial *self,
>  
>              /* Just keep on, will retry... */
>              written = 0;
> -        }
> +        } else
> +          written = bytes_sent;
>  
>          ctx->idx += written;
>      } else
> 


-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list