Merge pull request #1888 from ceph/wip-8472

msg_types.h: Don't use strncmp for comparing sockaddr_in.

Reviewed-by: Loic Dachary <loic@dachary.org>
This commit is contained in:
Loic Dachary 2014-05-30 10:03:04 +02:00
commit 8691773ef0

View File

@ -27,10 +27,10 @@ namespace ceph {
}
inline bool operator==(const sockaddr_in& a, const sockaddr_in& b) {
return strncmp((const char*)&a, (const char*)&b, sizeof(a)) == 0;
return memcmp((const char*)&a, (const char*)&b, sizeof(a)) == 0;
}
inline bool operator!=(const sockaddr_in& a, const sockaddr_in& b) {
return strncmp((const char*)&a, (const char*)&b, sizeof(a)) != 0;
return memcmp((const char*)&a, (const char*)&b, sizeof(a)) != 0;
}
extern ostream& operator<<(ostream& out, const sockaddr_storage &ss);