Skip to contentSkip to conversation

lomount: correct qsort compare function

PATCH In review Andreas Schwab 2 participants 2 messages Aug 22, 2011 – Aug 23, 2011 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lomount: correct qsort compare function

Return the correct value from comparing the operands.

---
 mount/lomount.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mount/lomount.c +1 -1
index 34d151a..fad58d5 100644
@@ -285,7 +285,7 @@ name2minor(int hasprefix, const char *name)
 static int
 cmpnum(const void *p1, const void *p2)
 {
-	return (* (int *) p1) > (* (int *) p2);
+	return (*(int *) p1 > *(int *) p2) - (*(int *) p1 < *(int *) p2);
 }
 
 /*
Signature · 7 lines
1.7.6


-- 
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
maintainer
#1 lore raw
Quoted 3 lines · Andreas Schwab
---
 mount/lomount.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Very good catch! Applied, thanks.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com