[PATCH 1/3] smpp_smsc: Print errno and close socket if read returns -1

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/.

Holger Hans Peter Freyther holger at freyther.de
Fri Jan 17 17:23:38 UTC 2014


On Fri, Jan 17, 2014 at 05:26:26PM +0100, Daniel Willmann wrote:

> -			LOGP(DSMPP, LOGL_ERROR, "[%s] read returned %d\n",
> -			     esme->system_id, rc);
> +			/* EINTR is a non-fatal error, just try again */
> +			if (errno == EINTR)
> +				return 0;

>  		if (rc < 0) {
> -			LOGP(DSMPP, LOGL_ERROR, "[%s] read returned %d\n",
> -				esme->system_id, rc);
> +			LOGP(DSMPP, LOGL_ERROR, "[%s] read returned %d (%s)\n",
> +				esme->system_id, rc, strerror(errno));
> +			goto dead_socket;

For reference. you should make the errno check in both cases or just
simplify the reading part and move the error handling to a macro.






More information about the OpenBSC mailing list