Code

proto: Let unmarshal functions return the number of bytes processed.
[sysdb.git] / src / tools / sysdb / command.c
index 2706dd220e12fbe8e5bacb0af539b313d08a8a8a..c809c1f8850db46109e7f06b7afd6c99127858cd 100644 (file)
@@ -49,9 +49,9 @@
 static void
 log_printer(sdb_strbuf_t *buf)
 {
-       uint32_t prio = sdb_proto_unmarshal_int32(SDB_STRBUF_STR(buf));
+       uint32_t prio = 0;
 
-       if (prio == UINT32_MAX) {
+       if (sdb_proto_unmarshal_int32(SDB_STRBUF_STR(buf), &prio) < 0) {
                sdb_log(SDB_LOG_WARNING, "Received a LOG message with invalid "
                                "or missing priority");
                prio = (uint32_t)SDB_LOG_ERR;