From 9315f853c49632a4d0c55dd41d88259ed0e13e89 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sat, 24 Nov 2018 04:46:27 +0900 Subject: [PATCH] udev-ctrl: fix coding style isuues --- src/udev/udev-ctrl.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c index 2dd0f2e39d..3ba945c99b 100644 --- a/src/udev/udev-ctrl.c +++ b/src/udev/udev-ctrl.c @@ -76,7 +76,7 @@ struct udev_ctrl *udev_ctrl_new_from_fd(int fd) { int r; uctrl = new0(struct udev_ctrl, 1); - if (uctrl == NULL) + if (!uctrl) return NULL; uctrl->n_ref = 1; @@ -147,7 +147,7 @@ DEFINE_PRIVATE_TRIVIAL_REF_FUNC(struct udev_ctrl, udev_ctrl); 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); @@ -155,7 +155,7 @@ int udev_ctrl_cleanup(struct udev_ctrl *uctrl) { } int udev_ctrl_get_fd(struct udev_ctrl *uctrl) { - if (uctrl == NULL) + if (!uctrl) return -EINVAL; return uctrl->sock; } @@ -166,7 +166,7 @@ struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) { int r; conn = new(struct udev_ctrl_connection, 1); - if (conn == NULL) + if (!conn) return NULL; conn->n_ref = 1; conn->uctrl = uctrl; @@ -220,7 +220,7 @@ static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int 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; @@ -312,7 +312,7 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) { 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; @@ -357,7 +357,7 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *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; }