diff options
author | ray <> | 2008-03-19 03:00:23 +0000 |
---|---|---|
committer | ray <> | 2008-03-19 03:00:23 +0000 |
commit | ffaeb4385bd768970027074604abaaf23ac9a04e (patch) | |
tree | eec9602b14b389b7cfec5ad17163219c8cfb95d5 | |
parent | 52d13c97d509b4115ee09ed44a8768febdca78ec (diff) | |
download | openbsd-ffaeb4385bd768970027074604abaaf23ac9a04e.tar.gz openbsd-ffaeb4385bd768970027074604abaaf23ac9a04e.tar.bz2 openbsd-ffaeb4385bd768970027074604abaaf23ac9a04e.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-- | src/lib/libc/string/bcmp.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libc/string/bcmp.c b/src/lib/libc/string/bcmp.c index a35689a209..fd5c93121e 100644 --- a/src/lib/libc/string/bcmp.c +++ b/src/lib/libc/string/bcmp.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bcmp.c,v 1.8 2005/08/08 08:05:37 espie Exp $ */ | 1 | /* $OpenBSD: bcmp.c,v 1.9 2008/03/19 03:00:23 ray Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1987 Regents of the University of California. | 4 | * Copyright (c) 1987 Regents of the University of California. |
@@ -44,12 +44,12 @@ bcmp(const void *b1, const void *b2, size_t length) | |||
44 | char *p1, *p2; | 44 | char *p1, *p2; |
45 | 45 | ||
46 | if (length == 0) | 46 | if (length == 0) |
47 | return(0); | 47 | return (0); |
48 | p1 = (char *)b1; | 48 | p1 = (char *)b1; |
49 | p2 = (char *)b2; | 49 | p2 = (char *)b2; |
50 | do | 50 | do |
51 | if (*p1++ != *p2++) | 51 | if (*p1++ != *p2++) |
52 | break; | 52 | return (1); |
53 | while (--length); | 53 | while (--length); |
54 | return(length); | 54 | return (0); |
55 | } | 55 | } |