summaryrefslogtreecommitdiffstats
path: root/libusbmuxd/libusbmuxd.c
diff options
context:
space:
mode:
authorGravatar David Sansome2010-09-25 16:52:10 +0200
committerGravatar Hector Martin2010-09-25 16:52:10 +0200
commit8e5f8a700569015bc36a84850c6d4b4bba5cd1ae (patch)
tree3ba5d02dc1df0bf7873d11d19f32376faf7fe234 /libusbmuxd/libusbmuxd.c
parent80e41939e3ae4d8c9e7184c31858b6689822f3d0 (diff)
downloadusbmuxd-8e5f8a700569015bc36a84850c6d4b4bba5cd1ae.tar.gz
usbmuxd-8e5f8a700569015bc36a84850c6d4b4bba5cd1ae.tar.bz2
Use Winsock's closesocket() function instead of close() on Windows.
Diffstat (limited to 'libusbmuxd/libusbmuxd.c')
-rw-r--r--libusbmuxd/libusbmuxd.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libusbmuxd/libusbmuxd.c b/libusbmuxd/libusbmuxd.c
index bb30c04..5eaf8e6 100644
--- a/libusbmuxd/libusbmuxd.c
+++ b/libusbmuxd/libusbmuxd.c
@@ -277,7 +277,7 @@ static int send_packet(int sfd, uint32_t message, uint32_t tag, void *payload, u
}
if (sent != (int)header.length) {
fprintf(stderr, "%s: ERROR: could not send whole packet\n", __func__);
- close(sfd);
+ close_socket(sfd);
return -1;
}
return sent;
@@ -405,11 +405,11 @@ retry:
use_tag++;
if (send_listen_packet(sfd, use_tag) <= 0) {
fprintf(stderr, "%s: ERROR: could not send listen packet\n", __func__);
- close(sfd);
+ close_socket(sfd);
return -1;
}
if (usbmuxd_get_result(sfd, use_tag, &res) && (res != 0)) {
- close(sfd);
+ close_socket(sfd);
#ifdef HAVE_PLIST
if ((res == RESULT_BADVERSION) && (proto_version != 1)) {
proto_version = 1;
@@ -538,7 +538,7 @@ int usbmuxd_unsubscribe()
event_cb = NULL;
if (pthread_kill(devmon, 0) == 0) {
- close(listenfd);
+ close_socket(listenfd);
listenfd = -1;
pthread_kill(devmon, SIGINT);
pthread_join(devmon, NULL);
@@ -574,7 +574,7 @@ retry:
if (usbmuxd_get_result(sfd, use_tag, &res) && (res == 0)) {
listen_success = 1;
} else {
- close(sfd);
+ close_socket(sfd);
#ifdef HAVE_PLIST
if ((res == RESULT_BADVERSION) && (proto_version != 1)) {
proto_version = 1;
@@ -633,7 +633,7 @@ retry:
}
// explicitly close connection
- close(sfd);
+ close_socket(sfd);
// terminating zero record
newlist = (usbmuxd_device_info_t*) realloc(*device_list, sizeof(usbmuxd_device_info_t) * (dev_cnt + 1));
@@ -716,7 +716,7 @@ retry:
#ifdef HAVE_PLIST
if ((res == RESULT_BADVERSION) && (proto_version == 0)) {
proto_version = 1;
- close(sfd);
+ close_socket(sfd);
goto retry;
}
#endif
@@ -730,14 +730,14 @@ retry:
return sfd;
}
- close(sfd);
+ close_socket(sfd);
return -1;
}
int usbmuxd_disconnect(int sfd)
{
- return close(sfd);
+ return close_socket(sfd);
}
int usbmuxd_send(int sfd, const char *data, uint32_t len, uint32_t *sent_bytes)