bugfix FlexRAN: only write to file if file is not null

This commit is contained in:
Robert Schmidt
2018-09-03 18:10:28 +02:00
parent 1e9f3235d3
commit 62957b97d8
+8 -2
View File
@@ -414,8 +414,14 @@ int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol_
FILE *f;
f = fopen(target, "wb");
fwrite(control_delegation_msg->payload.data, control_delegation_msg->payload.len, 1, f);
fclose(f);
if (f) {
fwrite(control_delegation_msg->payload.data, control_delegation_msg->payload.len, 1, f);
fclose(f);
}
else {
LOG_W(FLEXRAN_AGENT, "[%d] can not write control delegation data to %s\n",
mod_id, target);
}
// long time_elapsed_nanos = timer_end(vartime);
*msg = NULL;