diff options
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/udev-builtin-input_id.c | 2 | ||||
-rw-r--r-- | src/udev/udev-ctrl.c | 2 | ||||
-rw-r--r-- | src/udev/udev-event.c | 7 | ||||
-rw-r--r-- | src/udev/udev-rules.c | 6 | ||||
-rw-r--r-- | src/udev/udevadm-monitor.c | 4 | ||||
-rw-r--r-- | src/udev/udevd.c | 16 |
6 files changed, 19 insertions, 18 deletions
diff --git a/src/udev/udev-builtin-input_id.c b/src/udev/udev-builtin-input_id.c index 4691fc073d..9b99d1ff9f 100644 --- a/src/udev/udev-builtin-input_id.c +++ b/src/udev/udev-builtin-input_id.c @@ -59,7 +59,7 @@ static void get_cap_mask(struct udev_device *dev, snprintf(text, sizeof(text), "%s", udev_device_get_sysattr_value(pdev, attr)); log_debug("%s raw kernel attribute: %s", attr, text); - memset (bitmask, 0, bitmask_size); + memzero(bitmask, bitmask_size); i = 0; while ((word = strrchr(text, ' ')) != NULL) { val = strtoul (word+1, NULL, 16); diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c index 6d4dc6543b..2d315ea77f 100644 --- a/src/udev/udev-ctrl.c +++ b/src/udev/udev-ctrl.c @@ -268,7 +268,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; diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c index d4a54faf13..01d579b455 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c @@ -441,7 +441,7 @@ static void spawn_read(struct udev_event *event, } if (fd_stdout >= 0) { - memset(&ep_outpipe, 0, sizeof(struct epoll_event)); + memzero(&ep_outpipe, sizeof(struct epoll_event)); ep_outpipe.events = EPOLLIN; ep_outpipe.data.ptr = &fd_stdout; if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stdout, &ep_outpipe) < 0) { @@ -451,7 +451,7 @@ static void spawn_read(struct udev_event *event, } if (fd_stderr >= 0) { - memset(&ep_errpipe, 0, sizeof(struct epoll_event)); + memzero(&ep_errpipe, sizeof(struct epoll_event)); ep_errpipe.events = EPOLLIN; ep_errpipe.data.ptr = &fd_stderr; if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stderr, &ep_errpipe) < 0) { @@ -774,7 +774,8 @@ static int rename_netif_dev_fromname_toname(struct udev_device *dev,const char * return err; } - memset(&ifr, 0x00, sizeof(struct ifreq)); + memzero(&ifr, sizeof(struct ifreq)); + strscpy(ifr.ifr_name, IFNAMSIZ, oldname); strscpy(ifr.ifr_newname, IFNAMSIZ, newname); err = ioctl(sk, SIOCSIFNAME, &ifr); diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index d129b0f3a0..e5a15aa934 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -875,7 +875,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, struct token *token = &rule_tmp->token[rule_tmp->token_cur]; const char *attr = NULL; - memset(token, 0x00, sizeof(struct token)); + memzero(token, sizeof(struct token)); switch (type) { case TK_M_ACTION: @@ -1057,7 +1057,7 @@ static int add_rule(struct udev_rules *rules, char *line, const char *attr; struct rule_tmp rule_tmp; - memset(&rule_tmp, 0x00, sizeof(struct rule_tmp)); + memzero(&rule_tmp, sizeof(struct rule_tmp)); rule_tmp.rules = rules; rule_tmp.rule.type = TK_RULE; /* the offset in the rule is limited to unsigned short */ @@ -1657,7 +1657,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) strv_free(files); - memset(&end_token, 0x00, sizeof(struct token)); + memzero(&end_token, sizeof(struct token)); end_token.type = TK_END; add_token(rules, &end_token); log_debug("rules contain %zu bytes tokens (%u * %zu bytes), %zu bytes strings", diff --git a/src/udev/udevadm-monitor.c b/src/udev/udevadm-monitor.c index 6022e8db82..b2f7f6ba4c 100644 --- a/src/udev/udevadm-monitor.c +++ b/src/udev/udevadm-monitor.c @@ -194,7 +194,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) return 2; } - memset(&ep_udev, 0, sizeof(struct epoll_event)); + memzero(&ep_udev, sizeof(struct epoll_event)); ep_udev.events = EPOLLIN; ep_udev.data.fd = fd_udev; if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_udev, &ep_udev) < 0) { @@ -228,7 +228,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) return 4; } - memset(&ep_kernel, 0, sizeof(struct epoll_event)); + memzero(&ep_kernel, sizeof(struct epoll_event)); ep_kernel.events = EPOLLIN; ep_kernel.data.fd = fd_kernel; if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_kernel, &ep_kernel) < 0) { diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 224763eaa5..ae2067cddf 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -247,12 +247,12 @@ static void worker_new(struct event *event) goto out; } - memset(&ep_signal, 0, sizeof(struct epoll_event)); + memzero(&ep_signal, sizeof(struct epoll_event)); ep_signal.events = EPOLLIN; ep_signal.data.fd = fd_signal; fd_monitor = udev_monitor_get_fd(worker_monitor); - memset(&ep_monitor, 0, sizeof(struct epoll_event)); + memzero(&ep_monitor, sizeof(struct epoll_event)); ep_monitor.events = EPOLLIN; ep_monitor.data.fd = fd_monitor; @@ -303,7 +303,7 @@ static void worker_new(struct event *event) udev_monitor_send_device(worker_monitor, NULL, dev); /* send udevd the result of the event execution */ - memset(&msg, 0, sizeof(struct worker_message)); + memzero(&msg, sizeof(struct worker_message)); if (err != 0) msg.exitcode = err; msg.pid = getpid(); @@ -1183,23 +1183,23 @@ int main(int argc, char *argv[]) goto exit; } - memset(&ep_ctrl, 0, sizeof(struct epoll_event)); + memzero(&ep_ctrl, sizeof(struct epoll_event)); ep_ctrl.events = EPOLLIN; ep_ctrl.data.fd = fd_ctrl; - memset(&ep_inotify, 0, sizeof(struct epoll_event)); + memzero(&ep_inotify, sizeof(struct epoll_event)); ep_inotify.events = EPOLLIN; ep_inotify.data.fd = fd_inotify; - memset(&ep_signal, 0, sizeof(struct epoll_event)); + memzero(&ep_signal, sizeof(struct epoll_event)); ep_signal.events = EPOLLIN; ep_signal.data.fd = fd_signal; - memset(&ep_netlink, 0, sizeof(struct epoll_event)); + memzero(&ep_netlink, sizeof(struct epoll_event)); ep_netlink.events = EPOLLIN; ep_netlink.data.fd = fd_netlink; - memset(&ep_worker, 0, sizeof(struct epoll_event)); + memzero(&ep_worker, sizeof(struct epoll_event)); ep_worker.events = EPOLLIN; ep_worker.data.fd = fd_worker; |