chiark / gitweb /
[4/5] Apply missing fixes from upstream
[elogind.git] / src / login / inhibit.c
index 1f78e4b883d565179a354da6ffe19196e6fd403e..bfee1ca063ed3ace2186cb1a840a9fbb49cac8e2 100644 (file)
@@ -32,6 +32,8 @@
 #include "build.h"
 #include "strv.h"
 #include "formats-util.h"
+#include "process-util.h"
+#include "signal-util.h"
 
 static const char* arg_what = "idle:sleep:shutdown";
 static const char* arg_who = NULL;
@@ -177,9 +179,7 @@ static int parse_argv(int argc, char *argv[]) {
                         return 0;
 
                 case ARG_VERSION:
-                        puts(PACKAGE_STRING);
-                        puts(SYSTEMD_FEATURES);
-                        return 0;
+                        return version();
 
                 case ARG_WHAT:
                         arg_what = optarg;
@@ -221,9 +221,10 @@ static int parse_argv(int argc, char *argv[]) {
 
 int main(int argc, char *argv[]) {
         _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int r;
 
+        elogind_set_program_name(argv[0]);
         log_parse_environment();
         log_open();
 
@@ -273,6 +274,9 @@ int main(int argc, char *argv[]) {
                 if (pid == 0) {
                         /* Child */
 
+                        (void) reset_all_signal_handlers();
+                        (void) reset_signal_mask();
+
                         close_all_fds(NULL, 0);
 
                         execvp(argv[optind], argv + optind);