libimobiledevice / libusbmuxd

A client library to multiplex connections from and to iOS devices
https://libimobiledevice.org
GNU Lesser General Public License v2.1
574 stars 270 forks source link

usbmuxd_send is broken #138

Closed mexmer closed 3 months ago

mexmer commented 3 months ago

i noticed refactor of socket_send (in libimobile_glue) to accomodate wsaerror on windows, but change in usbmuxd_send function is necessesary.

because socket_send now returns negative value, usbmuxd_send must also return negative value.

previously to num_sent value of errno (which is positive) was assigned, and changed to negative with substraction operation, but now this operation makes returned value to be positive, so any function that checks on usbmuxd_send >= 0 will always think data was sent, even if there is error.

https://github.com/libimobiledevice/libusbmuxd/blob/2387d8e5820ee4621494e20434c0017aba6bea71/src/libusbmuxd.c#L1596 must be changed to return num_sent;

nikias commented 3 months ago

Fixed with bb6a786.