parameters: export empty BSON document even if there are no parameters to save

- otherwise a 'param reset_all' won't be saved until a parameter is changed
This commit is contained in:
Daniel Agar
2021-12-24 12:15:48 -05:00
parent 33d7b42040
commit 236794235a
+6 -5
View File
@@ -1371,11 +1371,6 @@ static int param_verify(int fd)
int
param_export(int fd, param_filter_func filter)
{
/* no modified parameters -> we are done */
if (param_values == nullptr) {
return 0;
}
int result = -1;
perf_begin(param_export_perf);
@@ -1410,6 +1405,12 @@ param_export(int fd, param_filter_func filter)
goto out;
}
// no modified parameters, export empty BSON document
if (param_values == nullptr) {
result = 0;
goto out;
}
while ((s = (struct param_wbuf_s *)utarray_next(param_values, s)) != nullptr) {
if (filter && !filter(s->param)) {
continue;