From f7374198e0053dc58fa96f7726da3ccae3d5cb4d 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 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/resource/ubridge.c b/src/resource/ubridge.c index 47e58655..4b692847 100644 --- a/src/resource/ubridge.c +++ b/src/resource/ubridge.c @@ -1005,9 +1005,14 @@ 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; + /* 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) { if (!(cmd_reg->flags & (CMD_KV_EXPORT_UDEV_TO_RESBUF | CMD_KV_EXPORT_UDEV_TO_EXPBUF))) {