/*
- * Copyright (C) 2004-2010 Kay Sievers <kay.sievers@vrfy.org>
+ * Copyright (C) 2004-2010 Kay Sievers <kay@vrfy.org>
*
* 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
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;
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';
}
/* 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);
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;
}
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;
}
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;
}
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");