Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions libs/etcdlib/src/etcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,20 @@ int etcdlib_get_directory(const etcdlib_t *etcdlib, const char* directory, etcdl
fprintf(stderr, "[ETCDLIB] Error: %s in js_root not found", ETCD_JSON_NODE);
}
if (js_rootnode != NULL) {
*modifiedIndex = 0;
retVal = etcd_get_recursive_values(js_rootnode, callback, arg, (json_int_t*)modifiedIndex);
long long modIndex = 0;
long long *ptrModIndex = NULL;
if(modifiedIndex != NULL) {
*modifiedIndex = 0;
ptrModIndex = modifiedIndex;
} else {
ptrModIndex = &modIndex;
}
retVal = etcd_get_recursive_values(js_rootnode, callback, arg, (json_int_t*)ptrModIndex);
long long indexFromHeader = etcd_get_current_index(reply.header);
if (indexFromHeader > *modifiedIndex) {
*modifiedIndex = indexFromHeader;
if (indexFromHeader > *ptrModIndex) {
*ptrModIndex = indexFromHeader;
}
} else {
} else if (modifiedIndex != NULL) {
// Error occurred, retrieve the index of ETCD from the error code
js_rootnode = json_object_get(js_root, ETCD_JSON_INDEX);
if(js_rootnode) {
Expand All @@ -294,7 +301,6 @@ int etcdlib_get_directory(const etcdlib_t *etcdlib, const char* directory, etcdl

} else {
fprintf(stderr, "[ETCDLIB] Error: index not found in error %s\n", reply.memory);

}

}
Expand Down