* util/deviceiter.c (compare_devices): If the by-id link for a

device couldn't be resolved, fall back to sorting by the by-id link
rather than segfaulting.
Reported and tested by: Daniel Mierswa.
This commit is contained in:
Colin Watson 2010-11-23 17:42:06 +00:00
parent 5225f32882
commit b7fbac1214
2 changed files with 16 additions and 6 deletions

View file

@ -1,3 +1,10 @@
2010-11-23 Colin Watson <cjwatson@ubuntu.com>
* util/deviceiter.c (compare_devices): If the by-id link for a
device couldn't be resolved, fall back to sorting by the by-id link
rather than segfaulting.
Reported and tested by: Daniel Mierswa.
2010-11-23 Colin Watson <cjwatson@ubuntu.com>
* Makefile.util.def (grub-menulst2cfg): List libraries in ldadd, not

View file

@ -485,12 +485,15 @@ compare_devices (const void *a, const void *b)
{
const struct device *left = (const struct device *) a;
const struct device *right = (const struct device *) b;
int ret;
ret = strcmp (left->kernel, right->kernel);
if (ret)
return ret;
else
return strcmp (left->stable, right->stable);
if (left->kernel && right->kernel)
{
int ret = strcmp (left->kernel, right->kernel);
if (ret)
return ret;
}
return strcmp (left->stable, right->stable);
}
#endif /* __linux__ */