[PATCH 1/2] ipa: Add forward declaration of struct osmo_fd
A pointer to struct osmo_fd is used in a few prototypes declared in gsm/ipa.h, but is neither declared explicitly nor is such a declaration reachable via the given include directives. This patch adds a forward declaration of this type to ensure proper compilation. Sponsored-by: On-Waves ehf --- include/osmocom/gsm/ipa.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/osmocom/gsm/ipa.h b/include/osmocom/gsm/ipa.h index 2878676..1227ee1 100644 --- a/include/osmocom/gsm/ipa.h +++ b/include/osmocom/gsm/ipa.h @@ -5,6 +5,8 @@ #include <osmocom/core/msgb.h> #include <osmocom/gsm/tlv.h> +struct osmo_fd; + /* internal (host-only) data structure */ struct ipaccess_unit { uint16_t site_id; -- 1.9.1
Currently, the ipa_send function returns -1 in one execution branch to indicate an error and -EIO in another. This is not consistent and can lead to a misinterpretation of the error code, since -1 is -EPERM and in general, EPERM is not returned by write(2). This patch changes the return code to -errno instead of -1 for the case that write(2) fails for same reason. So -rc is always a sensible error value if there is a failure. Sponsored-by: On-Waves ehf --- src/gsm/ipa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gsm/ipa.c b/src/gsm/ipa.c index ce98f08..7cff1e8 100644 --- a/src/gsm/ipa.c +++ b/src/gsm/ipa.c @@ -199,7 +199,7 @@ int ipa_send(int fd, const void *msg, size_t msglen) ret = write(fd, msg, msglen); if (ret < 0) - return ret; + return -errno; if (ret < msglen) { LOGP(DLINP, LOGL_ERROR, "ipa_send: short write\n"); return -EIO; -- 1.9.1
participants (1)
-
Jacob Erlbeck