These patches eradicate some of the easier-to-fix compiler warnings I keep seeing in almost every dev cycle. I'd be glad to have them on master. One of them is an actual error, ignoring return values.
Neels Hofmeyr (3): bsc_nat: fail if VTY telnet port cannot be bound, clarify comment ipaccess_rcvmsg: fix returncode, add partial write warning gsm340_rx_tpdu: comment-out two unused vars
openbsc/src/ipaccess/ipaccess-proxy.c | 8 +++++++- openbsc/src/libmsc/gsm_04_11.c | 7 +++++-- openbsc/src/osmo-bsc_nat/bsc_nat.c | 7 +++++-- 3 files changed, 17 insertions(+), 5 deletions(-)
--- openbsc/src/osmo-bsc_nat/bsc_nat.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c index 41291d9..2d4f2a8 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c @@ -1628,13 +1628,16 @@ int main(int argc, char **argv) osmo_stats_init(tall_bsc_ctx);
/* init vty and parse */ - telnet_init(tall_bsc_ctx, NULL, OSMO_VTY_PORT_BSC_NAT); + if (telnet_init(tall_bsc_ctx, NULL, OSMO_VTY_PORT_BSC_NAT)) { + fprintf(stderr, "Creating VTY telnet line failed\n"); + return -5; + } if (mgcp_parse_config(config_file, nat->mgcp_cfg, MGCP_BSC_NAT) < 0) { fprintf(stderr, "Failed to parse the config file: '%s'\n", config_file); return -3; }
- /* over rule the VTY config */ + /* over rule the VTY config for MSC IP */ if (msc_ip) bsc_nat_set_msc_ip(nat, msc_ip);
Kills a compiler warning. --- openbsc/src/ipaccess/ipaccess-proxy.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/openbsc/src/ipaccess/ipaccess-proxy.c b/openbsc/src/ipaccess/ipaccess-proxy.c index ab43b9e..3dfaeca 100644 --- a/openbsc/src/ipaccess/ipaccess-proxy.c +++ b/openbsc/src/ipaccess/ipaccess-proxy.c @@ -527,6 +527,12 @@ static int ipaccess_rcvmsg(struct ipa_proxy_conn *ipc, struct msgb *msg, return -EIO; } ret = write(bfd->fd, ipbc->id_resp, ipbc->id_resp_len); + if (ret != ipbc->id_resp_len) { + LOGP(DLINP, LOGL_ERROR, "Partial write: %d of %d\n", + ret, ipbc->id_resp_len); + ret = -EIO; + } + else ret = 0; break; case IPAC_MSGT_ID_ACK: DEBUGP(DLMI, "ID_ACK? -> ACK!\n"); @@ -537,7 +543,7 @@ static int ipaccess_rcvmsg(struct ipa_proxy_conn *ipc, struct msgb *msg, return 1; break; } - return 0; + return ret; }
struct msgb *ipaccess_proxy_read_msg(struct osmo_fd *bfd, int *error)
Kills two compiler warnings. --- openbsc/src/libmsc/gsm_04_11.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c index 266cd4d..e3d261e 100644 --- a/openbsc/src/libmsc/gsm_04_11.c +++ b/openbsc/src/libmsc/gsm_04_11.c @@ -357,7 +357,7 @@ static int gsm340_rx_tpdu(struct gsm_subscriber_connection *conn, struct msgb *m uint8_t *smsp = msgb_sms(msg); struct gsm_sms *gsms; unsigned int sms_alphabet; - uint8_t sms_mti, sms_mms, sms_vpf, sms_rp; + uint8_t sms_mti, sms_vpf; uint8_t *sms_vp; uint8_t da_len_bytes; uint8_t address_lv[12]; /* according to 03.40 / 9.1.2.5 */ @@ -371,11 +371,14 @@ static int gsm340_rx_tpdu(struct gsm_subscriber_connection *conn, struct msgb *m
/* invert those fields where 0 means active/present */ sms_mti = *smsp & 0x03; - sms_mms = !!(*smsp & 0x04); sms_vpf = (*smsp & 0x18) >> 3; gsms->status_rep_req = (*smsp & 0x20); gsms->ud_hdr_ind = (*smsp & 0x40); + /* This used to be unused code, avoid a recurring compiler warning: + uint8_t sms_mms, sms_rp; + sms_mms = !!(*smsp & 0x04); sms_rp = (*smsp & 0x80); + */
smsp++; gsms->msg_ref = *smsp++;