aboutsummaryrefslogtreecommitdiffstats
path: root/sap
diff options
context:
space:
mode:
authorWaldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>2011-05-31 12:46:48 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2011-06-01 14:44:21 +0300
commit6890d5129112d537a77709a65918a4ba445fc07d (patch)
treea2eda89087ab522f20ba0fbe188e90a3a5ae19be /sap
parentb90dd1154c05050cb89b1d41cb599a6d2d4bdb11 (diff)
downloadbluez-6890d5129112d537a77709a65918a4ba445fc07d.tar.gz
bluez-6890d5129112d537a77709a65918a4ba445fc07d.tar.xz
bluez-6890d5129112d537a77709a65918a4ba445fc07d.zip
Fix return value in send_message
send_message returns the number of sent bytes and -EIO in case of IO error now
Diffstat (limited to 'sap')
-rw-r--r--sap/server.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sap/server.c b/sap/server.c
index c5ea97ce..aa8ba237 100644
--- a/sap/server.c
+++ b/sap/server.c
@@ -254,7 +254,7 @@ static int send_message(struct sap_connection *conn, void *buf, size_t size)
if (!conn || !buf)
return -EINVAL;
- DBG("size %zu", size);
+ DBG("conn %p, size %zu", conn, size);
gstatus = g_io_channel_write_chars(conn->io, buf, size, &written,
&gerr);
@@ -263,13 +263,15 @@ static int send_message(struct sap_connection *conn, void *buf, size_t size)
g_error_free(gerr);
error("write error (0x%02x).", gstatus);
- return -EINVAL;
+ return -EIO;
}
- if (written != size)
- error("write error.(written %zu size %zu)", written, size);
+ if (written != size) {
+ error("written %zu bytes out of %zu", written, size);
+ return -EIO;
+ }
- return 0;
+ return written;
}
static int disconnect_ind(void *sap_device, uint8_t disc_type)