aboutsummaryrefslogtreecommitdiffstats
path: root/sap
diff options
context:
space:
mode:
authorAnderson Lizardo <anderson.lizardo@openbossa.org>2011-11-16 09:19:58 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2011-11-17 13:57:53 +0200
commit18f92a51a27d5f3bbe06067e3c9728a989551464 (patch)
tree23dd1f3590c2480f172d55ad9208aff8cf4dbdec /sap
parent5a1fd2f1a8811db4fa9e9f1bf78bbb59f53d3d12 (diff)
downloadbluez-18f92a51a27d5f3bbe06067e3c9728a989551464.tar.gz
bluez-18f92a51a27d5f3bbe06067e3c9728a989551464.tar.xz
bluez-18f92a51a27d5f3bbe06067e3c9728a989551464.zip
sap-u8500: Fix errno handling convention
Variables which are assigned to the errno variable (usually called "err") should be negative, and "-err" should be used where a positive value is needed.
Diffstat (limited to 'sap')
-rw-r--r--sap/sap-u8500.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sap/sap-u8500.c b/sap/sap-u8500.c
index e699fd76..ef7d95c1 100644
--- a/sap/sap-u8500.c
+++ b/sap/sap-u8500.c
@@ -571,9 +571,9 @@ static int simd_connect(void *sap_data)
sock = socket(PF_UNIX, SOCK_STREAM, 0);
if (sock < 0) {
- err = errno;
- sap_error("creating socket failed: %s", strerror(err));
- return -err;
+ err = -errno;
+ sap_error("creating socket failed: %s", strerror(-err));
+ return err;
}
memset(&addr, 0, sizeof(addr));
@@ -581,14 +581,14 @@ static int simd_connect(void *sap_data)
memcpy(addr.sun_path, STE_SIMD_SOCK, sizeof(STE_SIMD_SOCK) - 1);
if (connect(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
- err = errno;
- sap_error("connect to the socket failed: %s", strerror(err));
+ err = -errno;
+ sap_error("connect to the socket failed: %s", strerror(-err));
goto failed;
}
if (fcntl(sock, F_SETFL, O_NONBLOCK) > 0) {
- err = errno;
- sap_error("setting up socket failed: %s", strerror(err));
+ err = -errno;
+ sap_error("setting up socket failed: %s", strerror(-err));
goto failed;
}
@@ -598,7 +598,7 @@ static int simd_connect(void *sap_data)
failed:
close(sock);
- return -err;
+ return err;
}
void sap_connect_req(void *sap_device, uint16_t maxmsgsize)