On Thu, Oct 7, 2010 at 4:24 AM, Kay Sievers <[email protected]> wrote: > On Thu, Oct 7, 2010 at 06:03, <[email protected]> wrote: >> + if (udev_enumerate_add_match_subsystem(e, "block") < 0) { >> + r = -EIO; >> + goto finish; >> + } >> + >> + if (udev_enumerate_scan_devices(e) < 0) { >> + r = -EIO; >> + goto finish; >> + } >> + >> + first = udev_enumerate_get_list_entry(e); >> + >> + udev_list_entry_foreach(item, first) { >> + MountPoint *lb; >> + char buf[PATH_MAX]; >> + char *loop; >> + >> + snprintf(buf, sizeof(buf), "%s", >> udev_list_entry_get_name(item)); >> + if (strstr(buf, "loop")) > > I think, here you can let libudev return only the loop devices with: > udev_enumerate_add_match_sysname(, "loop*");
and the snprintf() is totally useless, the strstr case should be early continue "if (!strstr(..)) continue" -- Gustavo Sverzut Barbieri http://profusion.mobi embedded systems -------------------------------------- MSN: [email protected] Skype: gsbarbieri Mobile: +55 (19) 9225-2202 _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
