X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fudev%2Fudevadm-monitor.c;h=4d6af49b963a32577022618a5a12d833faef5716;hb=486cd82c8f7642016895b72bcc09a1bfe885a783;hp=5997dd8e18ae70185575ac4ae445056a77eab299;hpb=3e2147858f21943d5f4a781c60f33ac22c6096ed;p=elogind.git diff --git a/src/udev/udevadm-monitor.c b/src/udev/udevadm-monitor.c index 5997dd8e1..4d6af49b9 100644 --- a/src/udev/udevadm-monitor.c +++ b/src/udev/udevadm-monitor.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2010 Kay Sievers + * Copyright (C) 2004-2010 Kay Sievers * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -66,7 +66,7 @@ static void print_device(struct udev_device *device, const char *source, int pro static int adm_monitor(struct udev *udev, int argc, char *argv[]) { - struct sigaction act; + struct sigaction act = {}; sigset_t mask; int option; bool prop = false; @@ -116,7 +116,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) char subsys[UTIL_NAME_SIZE]; char *devtype; - util_strscpy(subsys, sizeof(subsys), optarg); + strscpy(subsys, sizeof(subsys), optarg); devtype = strchr(subsys, '/'); if (devtype != NULL) { devtype[0] = '\0'; @@ -149,9 +149,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) } /* set signal handlers */ - memset(&act, 0x00, sizeof(struct sigaction)); act.sa_handler = sig_handler; - sigemptyset(&act.sa_mask); act.sa_flags = SA_RESTART; sigaction(SIGINT, &act, NULL); sigaction(SIGTERM, &act, NULL); @@ -162,7 +160,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) fd_ep = epoll_create1(EPOLL_CLOEXEC); if (fd_ep < 0) { - err(udev, "error creating epoll fd: %m\n"); + log_error("error creating epoll fd: %m\n"); goto out; } @@ -204,7 +202,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) { - err(udev, "fail to add fd to epoll: %m\n"); + log_error("fail to add fd to epoll: %m\n"); goto out; } @@ -240,7 +238,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) { - err(udev, "fail to add fd to epoll: %m\n"); + log_error("fail to add fd to epoll: %m\n"); goto out; } @@ -253,7 +251,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) struct epoll_event ev[4]; int i; - fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); + fdcount = epoll_wait(fd_ep, ev, ELEMENTSOF(ev), -1); if (fdcount < 0) { if (errno != EINTR) fprintf(stderr, "error receiving uevent message: %m\n");