struct udev_ctrl *uctrl;
const int on = 1;
- uctrl = calloc(1, sizeof(struct udev_ctrl));
+ uctrl = new0(struct udev_ctrl, 1);
if (uctrl == NULL)
return NULL;
uctrl->refcount = 1;
struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl)
{
struct udev_ctrl_connection *conn;
- struct ucred ucred;
+ struct ucred ucred = {};
const int on = 1;
int r;
struct udev_ctrl_msg_wire ctrl_msg_wire;
int err = 0;
- memset(&ctrl_msg_wire, 0x00, sizeof(struct udev_ctrl_msg_wire));
+ memzero(&ctrl_msg_wire, sizeof(struct udev_ctrl_msg_wire));
strcpy(ctrl_msg_wire.version, "udev-" VERSION);
ctrl_msg_wire.magic = UDEV_CTRL_MAGIC;
ctrl_msg_wire.type = type;
pfd[0].fd = uctrl->sock;
pfd[0].events = POLLIN;
- r = poll(pfd, 1, timeout * 1000);
+ r = poll(pfd, 1, timeout * MSEC_PER_SEC);
if (r < 0) {
if (errno == EINTR)
continue;