]> git.ipfire.org Git - network.git/commitdiff
networkctl: Connect to the system bus
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 1 Mar 2023 15:52:20 +0000 (15:52 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 1 Mar 2023 15:52:20 +0000 (15:52 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/networkctl/main.c

index 14aafdd3cc175fe0294ff47d0630b551f88dd315..6ecaeb6aa569dd4220b5db1f03bf84b5302def23 100644 (file)
 #                                                                             #
 #############################################################################*/
 
+#include <stdio.h>
+
+#include <systemd/sd-bus.h>
+
 int main(int argc, char** argv) {
-       return 0;
+       sd_bus* bus = NULL;
+       int r;
+
+       // Connect to system bus
+       r = sd_bus_open_system(&bus);
+       if (r < 0) {
+               fprintf(stderr, "Could not connect to system bus: %m\n");
+               goto ERROR;
+       }
+
+       // XXX TODO Do all the work
+
+ERROR:
+       if (bus)
+               sd_bus_flush_close_unref(bus);
+
+       return r;
 }