avoid segfault in 'show interface' of absent icE1usb
Don't segfault when processing a "show interfaces" for an interface that is configured via VTY but not actually attached/found in the system: usb.c:693:29: runtime error: member access within null pointer of type 'struct e1_usb_intf_data' Depends: https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/30019 Depends: https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/30020 Change-Id: I2ce990bb57f6ae4edb3a99a4b7bf26a49f362410
This commit is contained in:
parent
7f204ac42a
commit
5806606ce5
|
@ -694,6 +694,12 @@ e1_usb_intf_gpsdo_state_string(char *buf, size_t len, const struct e1_intf *intf
|
|||
|
||||
OSMO_ASSERT(intf->drv == E1_DRIVER_USB);
|
||||
|
||||
if (!id) {
|
||||
/* This can happen for statically configured devices (config/vty) which are not
|
||||
* currently present */
|
||||
return snprintf(buf, len, "unknown");
|
||||
}
|
||||
|
||||
return snprintf(buf, len, "mode=%s, fix=%s, state=%s antenna=%s, tune=%u/%u, freq_est=%u",
|
||||
get_value_string(ice1usb_gpsdo_mode_str, last_st->mode),
|
||||
last_st->valid_fix ? "TRUE" : "FALSE",
|
||||
|
|
Loading…
Reference in New Issue