Fix invocation of udev_init
[petitboot] / discover / pb-discover.c
1
2 #include <stdlib.h>
3 #include <signal.h>
4
5 #include "udev.h"
6 #include "discover-server.h"
7 #include "device-handler.h"
8 #include "waiter.h"
9 #include "log.h"
10
11 int main(void)
12 {
13         struct device_handler *handler;
14         struct discover_server *server;
15         struct udev *udev;
16
17         /* we look for closed sockets when we write, so ignore SIGPIPE */
18         signal(SIGPIPE, SIG_IGN);
19
20         server = discover_server_init();
21         if (!server)
22                 return EXIT_FAILURE;
23
24         handler = device_handler_init(server);
25         if (!handler)
26                 return EXIT_FAILURE;
27
28         discover_server_set_device_source(server, handler);
29
30         udev = udev_init(handler);
31         if (!udev)
32                 return EXIT_FAILURE;
33
34         for (;;) {
35                 if (waiter_poll())
36                         return EXIT_FAILURE;
37         }
38
39
40         return EXIT_SUCCESS;
41 }