[gnome-battery-bench] Test we have logind proxy before taking the lock



commit 0d7f58f86461f576d431ad3f98c770fd961ebf7a
Author: Christian Kellner <gicmo gnome org>
Date:   Wed Mar 8 19:18:16 2017 +0100

    Test we have logind proxy before taking the lock
    
    Before trying to take the inhibitor lock via logind we should
    check we actually have the logind connection, because we are not
    failing in init() if we could not get the logind proxy.

 src/application.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/application.c b/src/application.c
index 9466680..3dfa6c6 100644
--- a/src/application.c
+++ b/src/application.c
@@ -931,6 +931,10 @@ gbb_application_inhibitor_lock_take(GbbApplication *application)
     GUnixFDList *fds;
     GError *error = NULL;
 
+    if (application->logind == NULL) {
+        return FALSE;
+    }
+
     if (application->inhibitor_fd > -1) {
         return TRUE;
     }


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