From e437e3cae10b730d3d8bb64e0b720064f39ca0b6 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Mon, 26 Jun 2017 17:31:14 -0400 Subject: [PATCH] xfree86: Fix off-by-one in X -configure Signed-off-by: Adam Jackson --- diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index df3ca50..3994805 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -545,11 +545,11 @@ driver_sort(const void *_l, const void *_r) return strcmp(l, r); /* left is a fallback */ - if (left >= 0) + if (left >= 0 && right < 0) return 1; /* right is a fallback */ - if (right >= 0) + if (right >= 0 && left > 0) return -1; /* both are fallbacks, which is worse */ @@ -563,7 +563,6 @@ fixup_video_driver_list(const char **drivers) /* walk to the end of the list */ for (end = drivers; *end && **end; end++); - end--; qsort(drivers, end - drivers, sizeof(const char *), driver_sort); } -- 2.13.0