treemanifest: check memcmp < 0 instead of memcmp == -1

Summary:
The memcmp contract is that the result is >0, 0, or <0. If <0 it's not
guaranteed to be -1, so let's broaden the check a bit.

Reviewed By: phillco

Differential Revision: D8190843

fbshipit-source-id: 78b864a639851a041c1a393f21a979d13eaa2e9c
This commit is contained in:
Durham Goode 2018-05-30 18:18:20 -07:00 committed by Facebook Github Bot
parent 2ad3a4421e
commit 06e89ef39e

View File

@ -235,7 +235,7 @@ void Manifest::computeNode(const char *p1, const char *p2, char *result) {
fbhg_sha1_ctx_t ctx;
fbhg_sha1_init(&ctx);
if (memcmp(p1, p2, BIN_NODE_SIZE) == -1) {
if (memcmp(p1, p2, BIN_NODE_SIZE) < 0) {
fbhg_sha1_update(&ctx, p1, BIN_NODE_SIZE);
fbhg_sha1_update(&ctx, p2, BIN_NODE_SIZE);
} else {