[frogr] Properly check return value of gets() in example.c
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [frogr] Properly check return value of gets() in example.c
- Date: Mon, 21 May 2012 23:08:28 +0000 (UTC)
commit fefc1b430b167004da9aea49af7c8f7efbc9b9df
Author: Mario Sanchez Prada <msanchez igalia com>
Date: Tue May 22 01:08:21 2012 +0200
Properly check return value of gets() in example.c
src/examples/example.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/src/examples/example.c b/src/examples/example.c
index 24adbd7..572d99b 100644
--- a/src/examples/example.c
+++ b/src/examples/example.c
@@ -673,22 +673,26 @@ get_auth_url_cb (GObject *object,
}
else
{
- gchar *verifier = NULL;
-
g_print ("[get_auth_url_cb]::Result: %s&perms=write\n\n",
auth_url ? auth_url : "No URL got");
/* Make a pause before continuing */
g_print ("\nEnter the verification code and press ENTER to continue: ");
- gets(buffer);
- verifier = encode_uri (buffer);
+ if (gets(buffer))
+ {
+ gchar *verifier = NULL;
- /* Continue finishing the authorization */
- g_print ("Finishing authorization...\n");
- fsp_session_complete_auth_async (session, verifier, NULL, complete_auth_cb, NULL);
+ verifier = encode_uri (buffer);
+
+ /* Continue finishing the authorization */
+ g_print ("Finishing authorization...\n");
+ fsp_session_complete_auth_async (session, verifier, NULL, complete_auth_cb, NULL);
+ g_free (verifier);
+ }
+ else
+ g_print ("Authorization failed. Can't continue.\n");
g_free (auth_url);
- g_free (verifier);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]