From c5ff2c2209e303034ec65a764ef471b18fe6c302 Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Thu, 14 Jul 2022 15:57:06 +0200 Subject: [PATCH] resource; ubridge: remove leading KV_PREFIX_OP_SYNC_C from key only if present while building cmd KV buffers --- src/resource/ubridge.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/resource/ubridge.c b/src/resource/ubridge.c index 47e58655..3c63c562 100644 --- a/src/resource/ubridge.c +++ b/src/resource/ubridge.c @@ -1005,8 +1005,13 @@ static int _build_cmd_kv_buffers(sid_resource_t *cmd_res, const struct cmd_reg * } } - key += 1; /* remove leading KV_PREFIX_OP_SYNC_C */ - key_size = strlen(key) + 1; + key_size = strlen(key); + + /* remove leading KV_PREFIX_OP_SYNC_C if present */ + if (*key == KV_PREFIX_OP_SYNC_C[0]) { + key += 1; + key_size -= 1; + } // TODO: Also deal with situation if the udev namespace values are defined as vectors by chance. if (_get_ns_from_key(key) == KV_NS_UDEV) {