int r;
uctrl = new0(struct udev_ctrl, 1);
- if (uctrl == NULL)
+ if (!uctrl)
return NULL;
uctrl->n_ref = 1;
DEFINE_TRIVIAL_UNREF_FUNC(struct udev_ctrl, udev_ctrl, udev_ctrl_free);
int udev_ctrl_cleanup(struct udev_ctrl *uctrl) {
- if (uctrl == NULL)
+ if (!uctrl)
return 0;
if (uctrl->cleanup_socket)
sockaddr_un_unlink(&uctrl->saddr.un);
}
int udev_ctrl_get_fd(struct udev_ctrl *uctrl) {
- if (uctrl == NULL)
+ if (!uctrl)
return -EINVAL;
return uctrl->sock;
}
int r;
conn = new(struct udev_ctrl_connection, 1);
- if (conn == NULL)
+ if (!conn)
return NULL;
conn->n_ref = 1;
conn->uctrl = uctrl;
ctrl_msg_wire.magic = UDEV_CTRL_MAGIC;
ctrl_msg_wire.type = type;
- if (buf != NULL)
+ if (buf)
strscpy(ctrl_msg_wire.buf, sizeof(ctrl_msg_wire.buf), buf);
else
ctrl_msg_wire.intval = intval;
struct ucred *cred;
uctrl_msg = new0(struct udev_ctrl_msg, 1);
- if (uctrl_msg == NULL)
+ if (!uctrl_msg)
return NULL;
uctrl_msg->n_ref = 1;
uctrl_msg->conn = conn;
cmsg = CMSG_FIRSTHDR(&smsg);
- if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) {
+ if (!cmsg || cmsg->cmsg_type != SCM_CREDENTIALS) {
log_error("no sender credentials received, message ignored");
goto err;
}