chiark / gitweb /
network-address,test-network: avoid undefined behaviour
[elogind.git] / src / udev / udevadm-monitor.c
index e776fb99dcfb14bc061fad69e4e1757bbf32d96d..15ded093390776020e27c4b577183af8ebef6ef8 100644 (file)
@@ -64,13 +64,16 @@ static void print_device(struct udev_device *device, const char *source, int pro
 }
 
 static void help(void) {
-        printf("Usage: udevadm monitor [--property] [--kernel] [--udev] [--help]\n"
-               "  -p,--property                            print the event properties\n"
-               "  -k,--kernel                              print kernel uevents\n"
-               "  -u,--udev                                print udev events\n"
-               "  -s,--subsystem-match=SUBSYSTEM[/DEVTYPE] filter events by subsystem\n"
-               "  -t,--tag-match=TAG                       filter events by tag\n"
-               "  -h,--help\n\n");
+        printf("%s monitor [--property] [--kernel] [--udev] [--help]\n\n"
+               "Listen to kernel and udev events.\n\n"
+               "  -h --help                                Show this help\n"
+               "     --version                             Show package version\n"
+               "  -p --property                            Print the event properties\n"
+               "  -k --kernel                              Print kernel uevents\n"
+               "  -u --udev                                Print udev events\n"
+               "  -s --subsystem-match=SUBSYSTEM[/DEVTYPE] Filter events by subsystem\n"
+               "  -t --tag-match=TAG                       Filter events by tag\n"
+               , program_invocation_short_name);
 }
 
 static int adm_monitor(struct udev *udev, int argc, char *argv[]) {
@@ -155,7 +158,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) {
 
         fd_ep = epoll_create1(EPOLL_CLOEXEC);
         if (fd_ep < 0) {
-                log_error("error creating epoll fd: %m");
+                log_error_errno(errno, "error creating epoll fd: %m");
                 return 1;
         }
 
@@ -195,7 +198,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) {
                 ep_udev.events = EPOLLIN;
                 ep_udev.data.fd = fd_udev;
                 if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_udev, &ep_udev) < 0) {
-                        log_error("fail to add fd to epoll: %m");
+                        log_error_errno(errno, "fail to add fd to epoll: %m");
                         return 2;
                 }
 
@@ -229,7 +232,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) {
                 ep_kernel.events = EPOLLIN;
                 ep_kernel.data.fd = fd_kernel;
                 if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_kernel, &ep_kernel) < 0) {
-                        log_error("fail to add fd to epoll: %m");
+                        log_error_errno(errno, "fail to add fd to epoll: %m");
                         return 5;
                 }
 
@@ -276,5 +279,5 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) {
 const struct udevadm_cmd udevadm_monitor = {
         .name = "monitor",
         .cmd = adm_monitor,
-        .help = "listen to kernel and udev events",
+        .help = "Listen to kernel and udev events",
 };