Workaround for infinite loop issue 34/35834/1
authorSuchang Woo <suchang.woo@samsung.com>
Wed, 25 Feb 2015 07:08:33 +0000 (16:08 +0900)
committerSuchang Woo <suchang.woo@samsung.com>
Wed, 25 Feb 2015 08:10:03 +0000 (17:10 +0900)
When Buxton daemon is terminated unexpectedly, a daemon or an application using
vconf-buxton API can fall into infinite loop.

Signed-off-by: Suchang Woo <suchang.woo@samsung.com>
Change-Id: Ib65f6224e0645db2c765bbcaa51166763c7fcf62

src/vconf-buxton.c

index 3d9b196..ea6a232 100644 (file)
@@ -528,6 +528,10 @@ _handle_buxton_response_ (int lock)
   result = buxton_client_handle_response (_buxton_ ());
   if (result < 0)
     ERR ("Error in buxton_client_handle_response: %m");
+  if (result == 0) {
+    ERR ("Connection closed");
+    result = -1;
+  }
   if (lock)
     UNLOCK (buxton);
   return result;
@@ -1153,7 +1157,13 @@ _notify_reg_unreg_ (struct notify *notif, bool reg)
 static gboolean
 _cb_glib_ (GIOChannel * src, GIOCondition cond, gpointer data)
 {
-  _handle_buxton_response_ (1);
+  int status;
+
+  status = _handle_buxton_response_ (1);
+  if (status < 0) {
+    glib_source = NULL;
+    return G_SOURCE_REMOVE;
+  }
   return G_SOURCE_CONTINUE;
 }