snprintf returns the number of written chars WITHOUT the null terminator,
even though it accepts the size WITH it.
This meant that even though the overwrite was successful,
the modification check always failed, leading the config
to think there was no existing entry and add another one.
Change-Id: Ic7e10e24258e0d54dc08f2c280f1f298569a282d
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
for (e = config->begin; e; e = e->next) {
if (!strcmp(e->key, key))
- return snprintf(e->value, sizeof e->value, "%s", value) == (strlen(value) + 1);
+ return snprintf(e->value, sizeof e->value, "%s", value) == (strlen(value));
}
return 0;