From cded3187f127c8319d80f03c31e007f04b931dfa Mon Sep 17 00:00:00 2001 From: Gerard Wagener Date: Mon, 3 Dec 2018 15:10:37 +0100 Subject: [PATCH] put the parsed uuid in the header --- client/d4.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/d4.c b/client/d4.c index fca2e00..0bcf5de 100644 --- a/client/d4.c +++ b/client/d4.c @@ -129,10 +129,16 @@ d4_t* d4_init(char* confdir) void d4_prepare_header(d4_t* d4) { + char uuid_text[24]; + uuid_t uuid; + bzero(&d4->header,sizeof(d4->header)); + bzero(&uuid_text, 24); d4->header.version = atoi(d4->conf[VERSION]); - //FIXME length handling - strncpy((char*)&(d4->header.uuid), d4->conf[UUID], SZUUID); + if (!uuid_parse(d4->conf[UUID],uuid)) { + memcpy(d4->header.uuid, uuid, SZUUID); + } + // If UUID cannot be parsed it is set to 0 d4->header.type = atoi(d4->conf[TYPE]); }