[PATCH 2/3] ipaccess_rcvmsg: fix returncode, add partial write warning

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Neels Hofmeyr nhofmeyr at sysmocom.de
Wed Feb 24 19:16:06 UTC 2016


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)
-- 
2.1.4




More information about the OpenBSC mailing list