Revision: 7443
Author:   nogu.dev
Date:     Sat Feb 11 02:10:45 2012
Log:      * uim/agent.c
  - (main): Check return value of fgets().
http://code.google.com/p/uim/source/detail?r=7443

Modified:
 /trunk/uim/agent.c

=======================================
--- /trunk/uim/agent.c  Wed Jan 11 00:17:24 2012
+++ /trunk/uim/agent.c  Sat Feb 11 02:10:45 2012
@@ -101,7 +101,9 @@
   printf("Hello World.\n");
   while (1) {
     char buf[32];
-    fgets(buf, 32, stdin);
+    if (fgets(buf, 32, stdin) == NULL) {
+      continue;
+    }
     if (isalpha((unsigned char)buf[0])) {
       uim_press_key(ac->uc, buf[0], 0);
     } else {

Reply via email to