PolicyKit: Branch 'wip/js-rule-files'

David Zeuthen david at kemper.freedesktop.org
Fri May 18 12:31:01 PDT 2012


 src/polkitbackend/polkitbackendjsauthority.c |   29 +++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

New commits:
commit 82e468369c3a8a0ec49b912660cba107252308b6
Author: David Zeuthen <davidz at redhat.com>
Date:   Fri May 18 15:30:48 2012 -0400

    Add a couple of more error checks
    
    Signed-off-by: David Zeuthen <davidz at redhat.com>

diff --git a/src/polkitbackend/polkitbackendjsauthority.c b/src/polkitbackend/polkitbackendjsauthority.c
index a0f9e27..9d721f3 100644
--- a/src/polkitbackend/polkitbackendjsauthority.c
+++ b/src/polkitbackend/polkitbackendjsauthority.c
@@ -584,11 +584,15 @@ subject_to_jsval (PolkitBackendJsAuthority  *authority,
 
   src = "new Subject();";
 
-  JS_EvaluateScript (authority->priv->cx,
-                     authority->priv->js_global,
-                     src, strlen (src),
-                     __FILE__, __LINE__,
-                     &ret_jsval);
+  if (!JS_EvaluateScript (authority->priv->cx,
+                          authority->priv->js_global,
+                          src, strlen (src),
+                          __FILE__, __LINE__,
+                          &ret_jsval))
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Evaluting '%s' failed", src);
+      goto out;
+    }
 
   obj = JSVAL_TO_OBJECT (ret_jsval);
 
@@ -702,11 +706,15 @@ details_to_jsval (PolkitBackendJsAuthority  *authority,
 
   src = "new Details();";
 
-  JS_EvaluateScript (authority->priv->cx,
-                     authority->priv->js_global,
-                     src, strlen (src),
-                     __FILE__, __LINE__,
-                     &ret_jsval);
+  if (!JS_EvaluateScript (authority->priv->cx,
+                          authority->priv->js_global,
+                          src, strlen (src),
+                          __FILE__, __LINE__,
+                          &ret_jsval))
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Evaluting '%s' failed", src);
+      goto out;
+    }
 
   obj = JSVAL_TO_OBJECT (ret_jsval);
   keys = polkit_details_get_keys (details);
@@ -726,6 +734,7 @@ details_to_jsval (PolkitBackendJsAuthority  *authority,
 
   ret = TRUE;
 
+ out:
   if (ret && out_jsval != NULL)
     *out_jsval = ret_jsval;
 


More information about the hal-commit mailing list