aboutsummaryrefslogtreecommitdiff
path: root/sbin/gbde/gbde.c
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2004-06-25 13:04:49 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2004-06-25 13:04:49 +0000
commit6122c0cd5ea53dfdac3b513914c108e0e8496664 (patch)
tree5f6281b8d9e171b1aed92d98f0d8f5c516e60022 /sbin/gbde/gbde.c
parent2758535974bb9946ac3a71c4d5aea1bba9ccca37 (diff)
downloadsrc-6122c0cd5ea53dfdac3b513914c108e0e8496664.tar.gz
src-6122c0cd5ea53dfdac3b513914c108e0e8496664.zip
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
Notes
Notes: svn path=/head/; revision=131101
Diffstat (limited to 'sbin/gbde/gbde.c')
-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 b90ac35ae308..5dda966c3f18 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;