chiark / gitweb /
Prep v228: Add remaining updates from upstream (3/3)
[elogind.git] / src / login / loginctl.c
index ac141dca73126d8c219b5283666ea9aff1d4fe51..fec9fe58b047f5567d04ad66f8f46283da135b8b 100644 (file)
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <unistd.h>
 #include <errno.h>
-#include <string.h>
 #include <getopt.h>
 #include <locale.h>
+#include <string.h>
+#include <unistd.h>
 
 #include "sd-bus.h"
-#include "sd-login.h"
-#include "bus-util.h"
+
+#include "alloc-util.h"
 #include "bus-error.h"
+#include "bus-util.h"
+//#include "cgroup-show.h"
+#include "cgroup-util.h"
 #include "log.h"
-#include "util.h"
+//#include "logs-show.h"
 #include "macro.h"
 #include "pager.h"
-#include "build.h"
+#include "parse-util.h"
+#include "process-util.h"
+#include "signal-util.h"
+#include "spawn-polkit-agent.h"
 #include "strv.h"
-#include "unit-name.h"
 #include "sysfs-show.h"
-// #include "logs-show.h"
-#include "cgroup-show.h"
-#include "cgroup-util.h"
-#include "spawn-polkit-agent.h"
-#include "verbs.h"
-#include "process-util.h"
 #include "terminal-util.h"
-#include "signal-util.h"
+#include "unit-name.h"
+#include "user-util.h"
+#include "util.h"
+#include "verbs.h"
+
+/// Additional includes for elogind
 #include "logind-action.h"
+#include "musl_missing.h"
+#include "sd-login.h"
+#include "virt.h"
 
 static char **arg_property = NULL;
 static bool arg_all = false;
@@ -746,7 +753,7 @@ static int print_property(const char *name, sd_bus_message *m, const char *conte
                         if (r < 0)
                                 return bus_log_parse_error(r);
 
-                        if (UID_IS_INVALID(uid)) {
+                        if (!uid_is_valid(uid)) {
                                 log_error("Invalid user ID: " UID_FMT, uid);
                                 return -EINVAL;
                         }
@@ -1694,7 +1701,7 @@ static int parse_argv(int argc, char *argv[]) {
         assert(argc >= 0);
         assert(argv);
 
-        while ((c = getopt_long(argc, argv, "hp:als:H:M:ci", options, NULL)) >= 0)
+        while ((c = getopt_long(argc, argv, "hp:als:H:M:n:o:ci", options, NULL)) >= 0)
 
                 switch (c) {
 
@@ -1703,9 +1710,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 'p': {
                         r = strv_extend(&arg_property, optarg);
@@ -1846,7 +1851,7 @@ int main(int argc, char *argv[]) {
         if (r <= 0)
                 goto finish;
 
-        r = bus_open_transport(arg_transport, arg_host, false, &bus);
+        r = bus_connect_transport(arg_transport, arg_host, false, &bus);
         if (r < 0) {
                 log_error_errno(r, "Failed to create bus connection: %m");
                 goto finish;