path: root/src/gsm
diff options
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-12-22 10:58:46 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-12-22 14:44:59 +0100
commita6be224b889baa8aecc4e7247e596583bbcfc8cb (patch)
tree8aed8de480962f27e0ae178d8bcf1b38e6707406 /src/gsm
parent3cd6753a1135b89e4665c78d18650f9addc1e874 (diff)
ipa: Return -errno instead of -1 in ipa_send
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
Diffstat (limited to 'src/gsm')
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gsm/ipa.c b/src/gsm/ipa.c
index ce98f08b..7cff1e81 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;