X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fudev%2Fudevd.c;h=92911efa90f86bc753542a6ab7801d3d7b0af802;hb=37d3ab1b7e114f0fb6dfb2e7273569b42794b76a;hp=ebd601e262c4117758b3603b52116ec93713d7b4;hpb=1298001ec5e320f9f9b6a9b925c8939b2579396d;p=elogind.git diff --git a/src/udev/udevd.c b/src/udev/udevd.c index ebd601e26..92911efa9 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -48,6 +48,7 @@ #include "sd-daemon.h" #include "cgroup-util.h" #include "dev-setup.h" +#include "fileio.h" static bool debug; @@ -499,7 +500,7 @@ static bool is_devpath_busy(struct event *event) return true; /* check our old name */ - if (event->devpath_old != NULL && strcmp(loop_event->devpath, event->devpath_old) == 0) { + if (event->devpath_old != NULL && streq(loop_event->devpath, event->devpath_old)) { event->delaying_seqnum = loop_event->seqnum; return true; } @@ -726,7 +727,7 @@ static int handle_inotify(struct udev *udev) int fd; log_debug("device %s closed, synthesising 'change'\n", udev_device_get_devnode(dev)); - util_strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL); + strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL); fd = open(filename, O_WRONLY); if (fd >= 0) { if (write(fd, "change", 6) < 0) @@ -813,7 +814,7 @@ static void static_dev_create_from_modules(struct udev *udev) FILE *f; uname(&kernel); - util_strscpyl(modules, sizeof(modules), ROOTPREFIX "/lib/modules/", kernel.release, "/modules.devname", NULL); + strscpyl(modules, sizeof(modules), ROOTPREFIX "/lib/modules/", kernel.release, "/modules.devname", NULL); f = fopen(modules, "re"); if (f == NULL) return; @@ -860,7 +861,7 @@ static void static_dev_create_from_modules(struct udev *udev) else continue; - util_strscpyl(filename, sizeof(filename), "/dev/", devname, NULL); + strscpyl(filename, sizeof(filename), "/dev/", devname, NULL); mkdir_parents_label(filename, 0755); label_context_set(filename, mode); log_debug("mknod '%s' %c%u:%u\n", filename, type, maj, min); @@ -909,7 +910,7 @@ static int convert_db(struct udev *udev) mkdir_p("/run/udev/data", 0755); /* old database */ - util_strscpyl(filename, sizeof(filename), "/dev/.udev/db", NULL); + strscpyl(filename, sizeof(filename), "/dev/.udev/db", NULL); if (access(filename, F_OK) < 0) return 0; @@ -938,7 +939,7 @@ static int convert_db(struct udev *udev) /* find database in old location */ id = udev_device_get_id_filename(device); - util_strscpyl(from, sizeof(from), "/dev/.udev/db/", id, NULL); + strscpyl(from, sizeof(from), "/dev/.udev/db/", id, NULL); if (lstat(from, &stats) == 0) { if (!have_db) { udev_device_read_db(device, from); @@ -948,7 +949,7 @@ static int convert_db(struct udev *udev) } /* find old database with $subsys:$sysname name */ - util_strscpyl(from, sizeof(from), "/dev/.udev/db/", + strscpyl(from, sizeof(from), "/dev/.udev/db/", udev_device_get_subsystem(device), ":", udev_device_get_sysname(device), NULL); if (lstat(from, &stats) == 0) { if (!have_db) { @@ -960,7 +961,7 @@ static int convert_db(struct udev *udev) /* find old database with the encoded devpath name */ util_path_encode(udev_device_get_devpath(device), devpath, sizeof(devpath)); - util_strscpyl(from, sizeof(from), "/dev/.udev/db/", devpath, NULL); + strscpyl(from, sizeof(from), "/dev/.udev/db/", devpath, NULL); if (lstat(from, &stats) == 0) { if (!have_db) { udev_device_read_db(device, from); @@ -1097,7 +1098,7 @@ int main(int argc, char *argv[]) for (;;) { int option; - option = getopt_long(argc, argv, "c:deDtN:hV", options, NULL); + option = getopt_long(argc, argv, "c:de:DtN:hV", options, NULL); if (option == -1) break; @@ -1117,11 +1118,11 @@ int main(int argc, char *argv[]) udev_set_log_priority(udev, LOG_DEBUG); break; case 'N': - if (strcmp (optarg, "early") == 0) { + if (streq(optarg, "early")) { resolve_names = 1; - } else if (strcmp (optarg, "late") == 0) { + } else if (streq(optarg, "late")) { resolve_names = 0; - } else if (strcmp (optarg, "never") == 0) { + } else if (streq(optarg, "never")) { resolve_names = -1; } else { fprintf(stderr, "resolve-names must be early, late or never\n");