Commit 4ee185d1 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

udev: fix signed overflow

parent 805cffa8
......@@ -137,11 +137,12 @@ struct services_discovery_sys_t
static int cmpdev (const void *a, const void *b)
{
const dev_t *da = a, *db = b;
dev_t delta = *da - *db;
if (sizeof (delta) > sizeof (int))
return delta ? (((signed)delta > 0) ? 1 : -1) : 0;
return (signed)delta;
if (*da > *db)
return +1;
if (*da < *db)
return -1;
return 0;
}
static void DestroyDevice (void *data)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment