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_vnops.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_vnops.c')
-rw-r--r-- | sys/fs/tmpfs/tmpfs_vnops.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 8365b97..54795c1 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -969,7 +969,7 @@ tmpfs_rename(struct vop_rename_args *v) /* Ensure that we have enough memory to hold the new name, if it * has to be changed. */ if (fcnp->cn_namelen != tcnp->cn_namelen || - memcmp(fcnp->cn_nameptr, tcnp->cn_nameptr, fcnp->cn_namelen) != 0) { + bcmp(fcnp->cn_nameptr, tcnp->cn_nameptr, fcnp->cn_namelen) != 0) { newname = malloc(tcnp->cn_namelen, M_TMPFSNAME, M_WAITOK); } else newname = NULL; |