sort(1): randomcoll: Don't sort on ENOMEM
PR: 230792 (1/many) Sponsored by: Dell EMC Isilon
This commit is contained in:
parent
fea616de3e
commit
e667e2a480
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=345891
@ -991,6 +991,7 @@ randomcoll(struct key_value *kv1, struct key_value *kv2,
|
||||
struct bwstring *s1, *s2;
|
||||
MD5_CTX ctx1, ctx2;
|
||||
char *b1, *b2;
|
||||
int cmp_res;
|
||||
|
||||
s1 = kv1->k;
|
||||
s2 = kv2->k;
|
||||
@ -1010,18 +1011,8 @@ randomcoll(struct key_value *kv1, struct key_value *kv2,
|
||||
MD5Update(&ctx2, bwsrawdata(s2), bwsrawlen(s2));
|
||||
b1 = MD5End(&ctx1, NULL);
|
||||
b2 = MD5End(&ctx2, NULL);
|
||||
if (b1 == NULL) {
|
||||
if (b2 == NULL)
|
||||
return (0);
|
||||
else {
|
||||
sort_free(b2);
|
||||
return (-1);
|
||||
}
|
||||
} else if (b2 == NULL) {
|
||||
sort_free(b1);
|
||||
return (+1);
|
||||
} else {
|
||||
int cmp_res;
|
||||
if (b1 == NULL || b2 == NULL)
|
||||
err(2, "MD5End");
|
||||
|
||||
cmp_res = strcmp(b1,b2);
|
||||
sort_free(b1);
|
||||
@ -1031,7 +1022,6 @@ randomcoll(struct key_value *kv1, struct key_value *kv2,
|
||||
cmp_res = bwscoll(s1, s2, 0);
|
||||
|
||||
return (cmp_res);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user