gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r14600 - gnunet/src/monkey


From: gnunet
Subject: [GNUnet-SVN] r14600 - gnunet/src/monkey
Date: Sun, 6 Mar 2011 14:18:16 +0100

Author: safey
Date: 2011-03-06 14:18:16 +0100 (Sun, 06 Mar 2011)
New Revision: 14600

Modified:
   gnunet/src/monkey/gdbmi_connect.c
   gnunet/src/monkey/gdbmi_get_free_vt.c
Log:
Codesonar fixes for gdbmi library

Modified: gnunet/src/monkey/gdbmi_connect.c
===================================================================
--- gnunet/src/monkey/gdbmi_connect.c   2011-03-05 21:03:21 UTC (rev 14599)
+++ gnunet/src/monkey/gdbmi_connect.c   2011-03-06 13:18:16 UTC (rev 14600)
@@ -273,53 +273,42 @@
    }
  do
    {
-    if (1)
-      {
-       /*
-        That's a must. If we just keep trying to read and failing things
-        become really sloooowwww. Instead we try and if it fails we wait
-        until something is available.
-        TODO: Implement something with the time out, a callback to ask the
-        application is we have to wait or not could be a good thing.
-       */
-       fd_set set;
-       struct timeval timeout;
-       int ret;
+   /*
+    That's a must. If we just keep trying to read and failing things
+    become really sloooowwww. Instead we try and if it fails we wait
+    until something is available.
+    TODO: Implement something with the time out, a callback to ask the
+    application is we have to wait or not could be a good thing.
+   */
+   fd_set set;
+   struct timeval timeout;
+   int ret;
 
-       r=mi_get_response(h);
-       if (r)
-          return mi_retire_response(h);
+   r=mi_get_response(h);
+   if (r)
+      return mi_retire_response(h);
 
-       FD_ZERO(&set);
-       FD_SET(h->from_gdb[0],&set);
-       timeout.tv_sec=h->time_out;
-       timeout.tv_usec=0;
-       ret=TEMP_FAILURE_RETRY(select(FD_SETSIZE,&set,NULL,NULL,&timeout));
-       if (!ret)
-         {
-          if (!mi_check_running(h))
-            {
-             h->died=1;
-             mi_error=MI_GDB_DIED;
-             return NULL;
-            }
-          if (h->time_out_cb)
-             ret=h->time_out_cb(h->time_out_cb_data);
-          if (!ret)
-            {
-             mi_error=MI_GDB_TIME_OUT;
-             return NULL;
-            }
-         }
-      }
-    else
-      {
-       r=mi_get_response(h);
-       if (r)
-          return mi_retire_response(h);
-       else
-          usleep(100);
-      }
+   FD_ZERO(&set);
+   FD_SET(h->from_gdb[0],&set);
+   timeout.tv_sec=h->time_out;
+   timeout.tv_usec=0;
+   ret=TEMP_FAILURE_RETRY(select(FD_SETSIZE,&set,NULL,NULL,&timeout));
+   if (!ret)
+     {
+      if (!mi_check_running(h))
+        {
+         h->died=1;
+         mi_error=MI_GDB_DIED;
+         return NULL;
+        }
+      if (h->time_out_cb)
+         ret=h->time_out_cb(h->time_out_cb_data);
+      if (!ret)
+        {
+         mi_error=MI_GDB_TIME_OUT;
+         return NULL;
+        }
+     }
    }
  while (!r);
 

Modified: gnunet/src/monkey/gdbmi_get_free_vt.c
===================================================================
--- gnunet/src/monkey/gdbmi_get_free_vt.c       2011-03-05 21:03:21 UTC (rev 
14599)
+++ gnunet/src/monkey/gdbmi_get_free_vt.c       2011-03-06 13:18:16 UTC (rev 
14600)
@@ -92,8 +92,10 @@
    }
 
  /* Get the state of the console -- in particular, the free VT field */
- if (ioctl(console_fd,VT_GETSTATE,&vts))
+ if (ioctl(console_fd,VT_GETSTATE,&vts)) {
+        close(console_fd);
     return -2;
+ }
  close(console_fd);
 
  /* We attempt to set our euid to 0; if we were run with euid 0 to




reply via email to

[Prev in Thread] Current Thread [Next in Thread]