]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- catch exception if requesting service name fails 658/head
authorArvin Schnell <aschnell@suse.de>
Fri, 4 Jun 2021 09:02:17 +0000 (11:02 +0200)
committerArvin Schnell <aschnell@suse.de>
Fri, 4 Jun 2021 09:02:17 +0000 (11:02 +0200)
client/snapper.cc
server/snapperd.cc

index 8ec382560df88fbcb9cbcd224d36c7906b462c22..76021f225194a93aa7cdca87d4c9a5abfa37fa05 100644 (file)
@@ -129,7 +129,7 @@ main(int argc, char** argv)
     }
     catch (const runtime_error& e)
     {
-       cerr << _("Failed to set locale. Fix your system.") << endl;
+       cerr << _("Failed to set locale.") << endl;
     }
 
     setLogDo(&log_do);
index cd19230e947a78b4414fa73031efecf507acb5bc..afc3433c74217cc0760d189867943fa7d6047497 100644 (file)
@@ -275,7 +275,18 @@ main(int argc, char** argv)
 
     y2mil("Requesting DBus name");
 
-    mainloop.request_name(SERVICE, DBUS_NAME_FLAG_REPLACE_EXISTING);
+    try
+    {
+       mainloop.request_name(SERVICE, DBUS_NAME_FLAG_REPLACE_EXISTING);
+    }
+    catch (const Exception& e)
+    {
+       SN_CAUGHT(e);
+
+       y2err("Failed to request DBus name");
+
+       return EXIT_FAILURE;
+    }
 
     y2mil("Loading snapper configs");
 
@@ -287,7 +298,7 @@ main(int argc, char** argv)
     {
        SN_CAUGHT(e);
 
-       y2err("failed to load snapper configs");
+       y2err("Failed to load snapper configs");
     }
 
     y2mil("Listening for method calls and signals");
@@ -298,5 +309,5 @@ main(int argc, char** argv)
 
     meta_snappers.unload();
 
-    return 0;
+    return EXIT_SUCCESS;
 }