diff options
| author | 2010-09-25 16:52:10 +0200 | |
|---|---|---|
| committer | 2010-09-25 16:52:10 +0200 | |
| commit | 8e5f8a700569015bc36a84850c6d4b4bba5cd1ae (patch) | |
| tree | 3ba5d02dc1df0bf7873d11d19f32376faf7fe234 /libusbmuxd/libusbmuxd.c | |
| parent | 80e41939e3ae4d8c9e7184c31858b6689822f3d0 (diff) | |
| download | usbmuxd-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.c | 18 |
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 | |||
| 277 | } | 277 | } |
| 278 | if (sent != (int)header.length) { | 278 | if (sent != (int)header.length) { |
| 279 | fprintf(stderr, "%s: ERROR: could not send whole packet\n", __func__); | 279 | fprintf(stderr, "%s: ERROR: could not send whole packet\n", __func__); |
| 280 | close(sfd); | 280 | close_socket(sfd); |
| 281 | return -1; | 281 | return -1; |
| 282 | } | 282 | } |
| 283 | return sent; | 283 | return sent; |
| @@ -405,11 +405,11 @@ retry: | |||
| 405 | use_tag++; | 405 | use_tag++; |
| 406 | if (send_listen_packet(sfd, use_tag) <= 0) { | 406 | if (send_listen_packet(sfd, use_tag) <= 0) { |
| 407 | fprintf(stderr, "%s: ERROR: could not send listen packet\n", __func__); | 407 | fprintf(stderr, "%s: ERROR: could not send listen packet\n", __func__); |
| 408 | close(sfd); | 408 | close_socket(sfd); |
| 409 | return -1; | 409 | return -1; |
| 410 | } | 410 | } |
| 411 | if (usbmuxd_get_result(sfd, use_tag, &res) && (res != 0)) { | 411 | if (usbmuxd_get_result(sfd, use_tag, &res) && (res != 0)) { |
| 412 | close(sfd); | 412 | close_socket(sfd); |
| 413 | #ifdef HAVE_PLIST | 413 | #ifdef HAVE_PLIST |
| 414 | if ((res == RESULT_BADVERSION) && (proto_version != 1)) { | 414 | if ((res == RESULT_BADVERSION) && (proto_version != 1)) { |
| 415 | proto_version = 1; | 415 | proto_version = 1; |
| @@ -538,7 +538,7 @@ int usbmuxd_unsubscribe() | |||
| 538 | event_cb = NULL; | 538 | event_cb = NULL; |
| 539 | 539 | ||
| 540 | if (pthread_kill(devmon, 0) == 0) { | 540 | if (pthread_kill(devmon, 0) == 0) { |
| 541 | close(listenfd); | 541 | close_socket(listenfd); |
| 542 | listenfd = -1; | 542 | listenfd = -1; |
| 543 | pthread_kill(devmon, SIGINT); | 543 | pthread_kill(devmon, SIGINT); |
| 544 | pthread_join(devmon, NULL); | 544 | pthread_join(devmon, NULL); |
| @@ -574,7 +574,7 @@ retry: | |||
| 574 | if (usbmuxd_get_result(sfd, use_tag, &res) && (res == 0)) { | 574 | if (usbmuxd_get_result(sfd, use_tag, &res) && (res == 0)) { |
| 575 | listen_success = 1; | 575 | listen_success = 1; |
| 576 | } else { | 576 | } else { |
| 577 | close(sfd); | 577 | close_socket(sfd); |
| 578 | #ifdef HAVE_PLIST | 578 | #ifdef HAVE_PLIST |
| 579 | if ((res == RESULT_BADVERSION) && (proto_version != 1)) { | 579 | if ((res == RESULT_BADVERSION) && (proto_version != 1)) { |
| 580 | proto_version = 1; | 580 | proto_version = 1; |
| @@ -633,7 +633,7 @@ retry: | |||
| 633 | } | 633 | } |
| 634 | 634 | ||
| 635 | // explicitly close connection | 635 | // explicitly close connection |
| 636 | close(sfd); | 636 | close_socket(sfd); |
| 637 | 637 | ||
| 638 | // terminating zero record | 638 | // terminating zero record |
| 639 | newlist = (usbmuxd_device_info_t*) realloc(*device_list, sizeof(usbmuxd_device_info_t) * (dev_cnt + 1)); | 639 | newlist = (usbmuxd_device_info_t*) realloc(*device_list, sizeof(usbmuxd_device_info_t) * (dev_cnt + 1)); |
| @@ -716,7 +716,7 @@ retry: | |||
| 716 | #ifdef HAVE_PLIST | 716 | #ifdef HAVE_PLIST |
| 717 | if ((res == RESULT_BADVERSION) && (proto_version == 0)) { | 717 | if ((res == RESULT_BADVERSION) && (proto_version == 0)) { |
| 718 | proto_version = 1; | 718 | proto_version = 1; |
| 719 | close(sfd); | 719 | close_socket(sfd); |
| 720 | goto retry; | 720 | goto retry; |
| 721 | } | 721 | } |
| 722 | #endif | 722 | #endif |
| @@ -730,14 +730,14 @@ retry: | |||
| 730 | return sfd; | 730 | return sfd; |
| 731 | } | 731 | } |
| 732 | 732 | ||
| 733 | close(sfd); | 733 | close_socket(sfd); |
| 734 | 734 | ||
| 735 | return -1; | 735 | return -1; |
| 736 | } | 736 | } |
| 737 | 737 | ||
| 738 | int usbmuxd_disconnect(int sfd) | 738 | int usbmuxd_disconnect(int sfd) |
| 739 | { | 739 | { |
| 740 | return close(sfd); | 740 | return close_socket(sfd); |
| 741 | } | 741 | } |
| 742 | 742 | ||
| 743 | int usbmuxd_send(int sfd, const char *data, uint32_t len, uint32_t *sent_bytes) | 743 | int usbmuxd_send(int sfd, const char *data, uint32_t len, uint32_t *sent_bytes) |
