cynara: add exception code for cynara_session_id retriving 03/121303/3 accepted/tizen/unified/20170629.085739 submit/tizen/20170622.043014
authorINSUN PYO <insun.pyo@samsung.com>
Mon, 27 Mar 2017 12:53:16 +0000 (21:53 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Mon, 12 Jun 2017 09:12:55 +0000 (09:12 +0000)
If client exit as soon as  async call, cynara_session_from_pid return null.
cynara_session_from_pid checks /proc/pid to verify client id.

===== reproduce =====
su - owner

dbus-send  --type=method_call  --system --dest=org.tizen.system.deviced  /Org/Tizen/System/DeviceD/Display  org.tizen.system.deviced.display.CustomBrightness
=====================

Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: Ic313e9d4f9531135865824d8512b9eb1ac6f4c9e

bus/connection.c

index 050bf8e054595aa609fe343704f31e04ccf4c718..1939da739c8eace6bf01ff59f10ef3b38caf1880 100644 (file)
@@ -1063,6 +1063,11 @@ const char *bus_connection_get_cynara_session_id (DBusConnection *connection)
       unsigned long pid;
       if (dbus_connection_get_unix_process_id(connection, &pid))
         d->cynara_session_id = cynara_session_from_pid(pid);
+
+      /* If client exits as soon as async call, cynara_session_from_pid() returns null.
+         cynara_session_from_pid checks /proc/pid to verify process */
+      if (d->cynara_session_id == NULL)
+        asprintf (&d->cynara_session_id, "/proc/%ld", pid);
     }
   return d->cynara_session_id;
 }