X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fudev%2Fudev-ctrl.c;h=74bbd3a99eade7b908ed3524125a7f3efee7124a;hb=edb85f0d8d0a84f27308a3728f3fde3c52b9dce2;hp=26879864b0335636d0a39a0190c98a136351f429;hpb=9f6445e34a57c270f013c9416c123e56261553dd;p=elogind.git diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c index 26879864b..74bbd3a99 100644 --- a/src/udev/udev-ctrl.c +++ b/src/udev/udev-ctrl.c @@ -75,7 +75,7 @@ struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd) 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; @@ -180,7 +180,7 @@ int udev_ctrl_get_fd(struct udev_ctrl *uctrl) 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; @@ -246,7 +246,7 @@ static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int 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; @@ -275,7 +275,7 @@ static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int 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;