[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/3] Fix compilation problems associated with -Wunused-result
From: |
Glenn Maynard |
Subject: |
Re: [PATCH 1/3] Fix compilation problems associated with -Wunused-result and -Werror |
Date: |
Sun, 29 May 2011 23:13:13 -0400 |
(I'm not sure why this is on help-gsasl, but since I'm reading it...)
On Sun, May 29, 2011 at 10:40 PM, Brad Hards <address@hidden> wrote:
> diff --git a/examples/client-callback.c b/examples/client-callback.c
> index ee014f7..4925802 100644
> --- a/examples/client-callback.c
> +++ b/examples/client-callback.c
> @@ -36,8 +36,11 @@ client_authenticate (Gsasl_session * session)
>
> do
> {
> + char *res;
> printf ("Input base64 encoded data from server:\n");
> - fgets (buf, sizeof (buf) - 1, stdin);
> + res = fgets (buf, sizeof (buf) - 1, stdin);
> + if (res == NULL)
> + buf[0] = '\0';
> if (buf[strlen (buf) - 1] == '\n')
> buf[strlen (buf) - 1] = '\0';
Example code typically has minimal error checking, to focus on the
topic of the example.
--
Glenn Maynard