diff options
author | obrien <obrien@FreeBSD.org> | 2008-09-23 14:45:10 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2008-09-23 14:45:10 +0000 |
commit | d31fa364752ed3b16d83a9cfa2866990824b3eb5 (patch) | |
tree | 4bf6265433e1ef6e4e0356df3e2303dc0c576080 /sys/fs/tmpfs/tmpfs_subr.c | |
parent | 219d6d162647c587a33965a8d84283e18c02887a (diff) | |
download | FreeBSD-src-d31fa364752ed3b16d83a9cfa2866990824b3eb5.zip FreeBSD-src-d31fa364752ed3b16d83a9cfa2866990824b3eb5.tar.gz |
The kernel implemented 'memcmp' is an alias for 'bcmp'. However, memcmp
and bcmp are not the same thing. 'man bcmp' states that the return is
"non-zero" if the two byte strings are not identical. Where as,
'man memcmp' states that the return is the "difference between the
first two differing bytes (treated as unsigned char values" if the
two byte strings are not identical.
So provide a proper memcmp(9), but it is a C implementation not a tuned
assembly implementation. Therefore bcmp(9) should be preferred over memcmp(9).
Diffstat (limited to 'sys/fs/tmpfs/tmpfs_subr.c')
-rw-r--r-- | sys/fs/tmpfs/tmpfs_subr.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index f5eea18..fad3196 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -585,7 +585,7 @@ tmpfs_dir_lookup(struct tmpfs_node *node, struct componentname *cnp) TAILQ_FOREACH(de, &node->tn_dir.tn_dirhead, td_entries) { MPASS(cnp->cn_namelen < 0xffff); if (de->td_namelen == (uint16_t)cnp->cn_namelen && - memcmp(de->td_name, cnp->cn_nameptr, de->td_namelen) == 0) { + bcmp(de->td_name, cnp->cn_nameptr, de->td_namelen) == 0) { found = 1; break; } |