changeset 22067:3684c9d16f6f

Part of a large patch from o_sukhodolsky to fix some build warnings. Refs #1344
author Richard Laager <rlaager@wiktel.com>
date Sun, 13 Jan 2008 20:46:18 +0000
parents 542d35f101ff
children a031a4fd6a7d
files libpurple/example/nullclient.c
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/example/nullclient.c	Sun Jan 13 16:44:39 2008 +0000
+++ b/libpurple/example/nullclient.c	Sun Jan 13 20:46:18 2008 +0000
@@ -268,6 +268,7 @@
 	GMainLoop *loop = g_main_loop_new(NULL, FALSE);
 	PurpleAccount *account;
 	PurpleSavedStatus *status;
+	char *res;
 
 	/* libpurple's built-in DNS resolution forks processes to perform
 	 * blocking lookups without blocking the main process.  It does not
@@ -290,12 +291,20 @@
 		}
 	}
 	printf("Select the protocol [0-%d]: ", i-1);
-	fgets(name, sizeof(name), stdin);
+	res = fgets(name, sizeof(name), stdin);
+	if (!res) {
+		fprintf(stderr, "Failed to gets protocol selection.");
+		abort();
+	}
 	sscanf(name, "%d", &num);
 	prpl = g_list_nth_data(names, num);
 
 	printf("Username: ");
-	fgets(name, sizeof(name), stdin);
+	res = fgets(name, sizeof(name), stdin);
+	if (!res) {
+		fprintf(stderr, "Failed to read user name.");
+		abort();
+	}
 	name[strlen(name) - 1] = 0;  /* strip the \n at the end */
 
 	/* Create the account */