diff --git a/WHATS_NEW b/WHATS_NEW index 1bb373e1b..ade334cec 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.89 - ================================== + Reduce number of lstat calls when selecting device alias. Add function to inialize common structure device members. Always zalloc device structure during initialization. Fix missing thread list manipulation protection in dmeventd. diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c index d236bd643..a909c6f52 100644 --- a/lib/device/dev-cache.c +++ b/lib/device/dev-cache.c @@ -259,6 +259,13 @@ static int _compare_paths(const char *path0, const char *path1) s0 = &p0[0] + 1; s1 = &p1[0] + 1; + /* + * If we reach here, both paths are the same length. + * Now skip past identical path components. + */ + while (*s0 && *s0 == *s1) + s0++, s1++; + /* We prefer symlinks - they exist for a reason! * So we prefer a shorter path before the first symlink in the name. * FIXME Configuration option to invert this? */