From 34558ae9458519f785c1fee48982b1efccaff446 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 4 Jul 2010 14:35:05 +0200 Subject: s3: Slight reshaping of server_exists_parse Doing a copy and then do the compare is a bit pointless, use memcmp --- source3/lib/serverid.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source3') diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c index 5f97bd310f..e9c72961e6 100644 --- a/source3/lib/serverid.c +++ b/source3/lib/serverid.c @@ -183,10 +183,12 @@ static int server_exists_parse(TDB_DATA key, TDB_DATA data, void *priv) return -1; } - /* memcpy, data.dptr might not be aligned */ - memcpy(&unique_id, data.dptr, sizeof(unique_id)); - - state->exists = (state->id->unique_id == unique_id); + /* + * Use memcmp, not direct compare. data.dptr might not be + * aligned. + */ + state->exists = + (memcmp(&unique_id, data.dptr, sizeof(unique_id)) == 0); return 0; } -- cgit