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>
+
+ * 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
{
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__ */