summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2004-06-25 13:04:49 +0000
committersobomax <sobomax@FreeBSD.org>2004-06-25 13:04:49 +0000
commit8ce714e6e34bce42487802bd21bbc6f3b70377f9 (patch)
tree5f6281b8d9e171b1aed92d98f0d8f5c516e60022
parent211c1eafc918219359bb552e2e7f4ec56ba116a1 (diff)
downloadFreeBSD-src-8ce714e6e34bce42487802bd21bbc6f3b70377f9.zip
FreeBSD-src-8ce714e6e34bce42487802bd21bbc6f3b70377f9.tar.gz
o Fix semantics of comparison function for qsort(3). According to qsort(3)
manpage: The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. Therefore, simply returning "arg1 > arg2" is incorrect. Actually it works but for the number of items to be sorted less than 7 due to special case handling in qsort(3); o add missing '\n' to one of usage() calls. Approved by: phk
-rw-r--r--sbin/gbde/gbde.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sbin/gbde/gbde.c b/sbin/gbde/gbde.c
index b90ac35..5dda966 100644
--- a/sbin/gbde/gbde.c
+++ b/sbin/gbde/gbde.c
@@ -480,7 +480,11 @@ sorthelp(const void *a, const void *b)
oa = a;
ob = b;
- return (*oa > *ob);
+ if (*oa > *ob)
+ return 1;
+ if (*oa < *ob)
+ return -1;
+ return 0;
}
static void
@@ -721,7 +725,7 @@ main(int argc, char **argv)
if ((i = modfind("g_bde")) < 0) {
/* need to load the gbde module */
if (kldload(GBDEMOD) < 0 || modfind("g_bde") < 0) {
- usage(GBDEMOD ": Kernel module not available");
+ usage(GBDEMOD ": Kernel module not available\n");
}
}
doopen = 0;
OpenPOWER on IntegriCloud