summaryrefslogtreecommitdiff
path: root/src/udev/udev-node.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/udev/udev-node.c')
-rw-r--r--src/udev/udev-node.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c
index d10c63aaa0..4fca46495e 100644
--- a/src/udev/udev-node.c
+++ b/src/udev/udev-node.c
@@ -53,10 +53,10 @@ static int node_symlink(struct udev_device *dev, const char *node, const char *s
l = sizeof(target);
while (slink[i] != '\0') {
if (slink[i] == '/')
- l = util_strpcpy(&s, l, "../");
+ l = strpcpy(&s, l, "../");
i++;
}
- l = util_strscpy(s, l, &node[tail]);
+ l = strscpy(s, l, &node[tail]);
if (l == 0) {
err = -EINVAL;
goto exit;
@@ -74,7 +74,7 @@ static int node_symlink(struct udev_device *dev, const char *node, const char *s
len = readlink(slink, buf, sizeof(buf));
if (len > 0 && len < (int)sizeof(buf)) {
buf[len] = '\0';
- if (strcmp(target, buf) == 0) {
+ if (streq(target, buf)) {
log_debug("preserve already existing symlink '%s' to '%s'\n", slink, target);
label_fix(slink, true, false);
utimensat(AT_FDCWD, slink, NULL, AT_SYMLINK_NOFOLLOW);
@@ -99,7 +99,7 @@ static int node_symlink(struct udev_device *dev, const char *node, const char *s
}
log_debug("atomically replace '%s'\n", slink);
- util_strscpyl(slink_tmp, sizeof(slink_tmp), slink, ".tmp-", udev_device_get_id_filename(dev), NULL);
+ strscpyl(slink_tmp, sizeof(slink_tmp), slink, ".tmp-", udev_device_get_id_filename(dev), NULL);
unlink(slink_tmp);
do {
err = mkdir_parents_label(slink_tmp, 0755);
@@ -134,7 +134,7 @@ static const char *link_find_prioritized(struct udev_device *dev, bool add, cons
if (add) {
priority = udev_device_get_devlink_priority(dev);
- util_strscpy(buf, bufsize, udev_device_get_devnode(dev));
+ strscpy(buf, bufsize, udev_device_get_devnode(dev));
target = buf;
}
@@ -154,7 +154,7 @@ static const char *link_find_prioritized(struct udev_device *dev, bool add, cons
log_debug("found '%s' claiming '%s'\n", dent->d_name, stackdir);
/* did we find ourself? */
- if (strcmp(dent->d_name, udev_device_get_id_filename(dev)) == 0)
+ if (streq(dent->d_name, udev_device_get_id_filename(dev)))
continue;
dev_db = udev_device_new_from_device_id(udev, dent->d_name);
@@ -167,7 +167,7 @@ static const char *link_find_prioritized(struct udev_device *dev, bool add, cons
log_debug("'%s' claims priority %i for '%s'\n",
udev_device_get_syspath(dev_db), udev_device_get_devlink_priority(dev_db), stackdir);
priority = udev_device_get_devlink_priority(dev_db);
- util_strscpy(buf, bufsize, devnode);
+ strscpy(buf, bufsize, devnode);
target = buf;
}
}
@@ -189,8 +189,8 @@ static void link_update(struct udev_device *dev, const char *slink, bool add)
char buf[UTIL_PATH_SIZE];
util_path_encode(slink + strlen("/dev"), name_enc, sizeof(name_enc));
- util_strscpyl(dirname, sizeof(dirname), "/run/udev/links/", name_enc, NULL);
- util_strscpyl(filename, sizeof(filename), dirname, "/", udev_device_get_id_filename(dev), NULL);
+ strscpyl(dirname, sizeof(dirname), "/run/udev/links/", name_enc, NULL);
+ strscpyl(filename, sizeof(filename), dirname, "/", udev_device_get_id_filename(dev), NULL);
if (!add && unlink(filename) == 0)
rmdir(dirname);
@@ -238,7 +238,7 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev
udev_list_entry_foreach(list_entry_current, udev_device_get_devlinks_list_entry(dev)) {
const char *name_current = udev_list_entry_get_name(list_entry_current);
- if (strcmp(name, name_current) == 0) {
+ if (streq(name, name_current)) {
found = 1;
break;
}
@@ -259,7 +259,7 @@ static int node_permissions_apply(struct udev_device *dev, bool apply, mode_t mo
struct stat stats;
int err = 0;
- if (strcmp(udev_device_get_subsystem(dev), "block") == 0)
+ if (streq(udev_device_get_subsystem(dev), "block"))
mode |= S_IFBLK;
else
mode |= S_IFCHR;
@@ -308,7 +308,7 @@ void udev_node_add(struct udev_device *dev, bool apply, mode_t mode, uid_t uid,
/* always add /dev/{block,char}/$major:$minor */
snprintf(filename, sizeof(filename), "/dev/%s/%u:%u",
- strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char",
+ streq(udev_device_get_subsystem(dev), "block") ? "block" : "char",
major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev)));
node_symlink(dev, udev_device_get_devnode(dev), filename);
@@ -328,7 +328,7 @@ void udev_node_remove(struct udev_device *dev)
/* remove /dev/{block,char}/$major:$minor */
snprintf(filename, sizeof(filename), "/dev/%s/%u:%u",
- strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char",
+ streq(udev_device_get_subsystem(dev), "block") ? "block" : "char",
major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev)));
unlink(filename);
}