cedric pushed a commit to branch master.

commit 4b473c90c0b391a9b2940a4461d2a481f43c2018
Author: Jean-Philippe Andre <[email protected]>
Date:   Thu Jun 20 14:11:32 2013 +0900

    cserve2: Handle interrupts when failing to read from server
    
    If we don't do that, the client will end up in an infinite loop
    from where it just can't exit, if the server is dead/stuck.
---
 src/lib/evas/cserve2/evas_cs2_client.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/lib/evas/cserve2/evas_cs2_client.c 
b/src/lib/evas/cserve2/evas_cs2_client.c
index 2212955..5830c45 100644
--- a/src/lib/evas/cserve2/evas_cs2_client.c
+++ b/src/lib/evas/cserve2/evas_cs2_client.c
@@ -360,6 +360,11 @@ _server_dispatch_until(unsigned int rid)
                    * Or maybe just return EINA_FALSE after some timeout?
                    * -- jpeg
                    */
+                  if (errno == EINTR)
+                    {
+                       DBG("giving up on request %d after interrupt", rid);
+                       return EINA_FALSE;
+                    }
                }
           }
      }
@@ -638,7 +643,7 @@ _image_open_server_send(Image_Entry *ie, const char *file, 
const char *key, Evas
    return msg_open.base.rid;
 }
 
-unsigned int
+static unsigned int
 _image_setopts_server_send(Image_Entry *ie)
 {
    File_Entry *fentry;
@@ -651,6 +656,8 @@ _image_setopts_server_send(Image_Entry *ie)
    fentry = ie->data1;
 
    dentry = calloc(1, sizeof(*dentry));
+   if (!dentry)
+     return 0;
 
    memset(&msg, 0, sizeof(msg));
    dentry->image_id = ++_data_id;
@@ -681,7 +688,10 @@ _image_setopts_server_send(Image_Entry *ie)
    msg.opts.orientation = ie->load_opts.orientation;
 
    if (!_server_send(&msg, sizeof(msg), NULL, NULL))
-     return 0;
+     {
+        free(dentry);
+        return 0;
+     }
 
    ie->data2 = dentry;
 

-- 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

Reply via email to