dog/vdi: bug fix for voting majority, add test case to test it

There is a critical error in the function vote_majority_object.
When all the three copies are different, the original logic still
choose the last one as majority.
The root cause is step 2 of the voting algorithm was missed.

Signed-off-by: Ruoyu <liangry@ucweb.com>
Reviewed-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
sheep/object_cache: fix potential crash in object_cache_remove

If object is not found, entry reference to NULL, the below statement
will cause a crash.
struct object_cache *oc = entry->oc;

Signed-off-by: Ruoyu <liangry@ucweb.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
sheep/ops: fix potential type conversion error

Similar to lib/logger, epoch_log_read_with_timestamp will return -1
for any failure and it cannot be assigned to a variable in type of
size_t. Otherwise, the error branch will never be reached.

Signed-off-by: Ruoyu <liangry@ucweb.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
lib/logger: fix potential type conversion error

The return type of snprintf is int. If an output error is encountered,
a negative value is returned. Assigning a negative value to a variable
in type of size_t is danger. The result will be a huge positive number
and the error branch will never be reached.
To avoid it, change the type of variable 'len' to ssize_t. In Comparison,
convert it back to size_t.

Signed-off-by: Ruoyu <liangry@ucweb.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>