summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorray <ray@openbsd.org>2008-03-19 03:00:23 +0000
committerray <ray@openbsd.org>2008-03-19 03:00:23 +0000
commitfaae02496ec2c67607c59f1fe4877411a969457c (patch)
treeb706eec59ac32b4a970d3281c71095f3f8ff142a
parentFix mention of authpf_users table (s/authpf users/authpf_users/). (diff)
downloadwireguard-openbsd-faae02496ec2c67607c59f1fe4877411a969457c.tar.xz
wireguard-openbsd-faae02496ec2c67607c59f1fe4877411a969457c.zip
bcmp(3) tries to return length, which is a size_t, as an int.
Instead, just return 1 if there is a difference. Found by lint. OK millert.
-rw-r--r--lib/libc/string/bcmp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/string/bcmp.c b/lib/libc/string/bcmp.c
index a35689a209e..fd5c93121ee 100644
--- a/lib/libc/string/bcmp.c
+++ b/lib/libc/string/bcmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bcmp.c,v 1.8 2005/08/08 08:05:37 espie Exp $ */
+/* $OpenBSD: bcmp.c,v 1.9 2008/03/19 03:00:23 ray Exp $ */
/*
* Copyright (c) 1987 Regents of the University of California.
@@ -44,12 +44,12 @@ bcmp(const void *b1, const void *b2, size_t length)
char *p1, *p2;
if (length == 0)
- return(0);
+ return (0);
p1 = (char *)b1;
p2 = (char *)b2;
do
if (*p1++ != *p2++)
- break;
+ return (1);
while (--length);
- return(length);
+ return (0);
}