Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package libusbmuxd for openSUSE:Factory 
checked in at 2026-11-04 19:42:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libusbmuxd (Old)
 and      /work/SRC/openSUSE:Factory/.libusbmuxd.new.3759290 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libusbmuxd"

Wed Nov  4 19:42:57 2026 rev:12 rq:1394707 version:2.1.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/libusbmuxd/libusbmuxd.changes    2025-02-28 
17:38:37.834837990 +0100
+++ /work/SRC/openSUSE:Factory/.libusbmuxd.new.3759290/libusbmuxd.changes       
2026-11-04 19:43:13.253788038 +0100
@@ -1,0 +2,12 @@
+Fri Apr 10 23:06:39 UTC 2026 - Dirk Müller <[email protected]>
+
+- update to 2.1.1:
+  * Changes:
+  * tools: Fix potential issue with select() in case the
+    network fd is higher than the usbmux fd
+  * Switch to better initializer strategy
+  * Fix compilation on MSVC
+  * iproxy: Make sure to print correct socket error messages
+  * inetcat: Make sure to report correct error messages
+
+-------------------------------------------------------------------

Old:
----
  libusbmuxd-2.1.0.tar.bz2

New:
----
  libusbmuxd-2.1.1.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libusbmuxd.spec ++++++
--- /var/tmp/diff_new_pack.llQItg/_old  2026-11-04 19:43:13.991818931 +0100
+++ /var/tmp/diff_new_pack.llQItg/_new  2026-11-04 19:43:13.992818973 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package libusbmuxd
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2026 SUSE LLC and contributors
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,10 +18,10 @@
 
 %define libname libusbmuxd-2_0-7
 Name:           libusbmuxd
-Version:        2.1.0
+Version:        2.1.1
 Release:        0
 Summary:        A client library to multiplex connections from and to iOS 
devices
-License:        LGPL-2.1-or-later AND GPL-2.0-or-later
+License:        GPL-2.0-or-later AND LGPL-2.1-or-later
 URL:            https://github.com/libimobiledevice/libusbmuxd
 Source:         
https://github.com/libimobiledevice/libusbmuxd/releases/download/%{version}/%{name}-%{version}.tar.bz2
 Source99:       baselibs.conf

++++++ libusbmuxd-2.1.0.tar.bz2 -> libusbmuxd-2.1.1.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libusbmuxd-2.1.0/.tarball-version 
new/libusbmuxd-2.1.1/.tarball-version
--- old/libusbmuxd-2.1.0/.tarball-version       2024-03-27 02:36:46.000000000 
+0100
+++ new/libusbmuxd-2.1.1/.tarball-version       2025-06-04 15:36:04.000000000 
+0200
@@ -1 +1 @@
-2.1.0
+2.1.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libusbmuxd-2.1.0/Makefile.am 
new/libusbmuxd-2.1.1/Makefile.am
--- old/libusbmuxd-2.1.0/Makefile.am    2022-02-10 04:28:29.000000000 +0100
+++ new/libusbmuxd-2.1.1/Makefile.am    2024-04-15 20:13:48.000000000 +0200
@@ -7,4 +7,5 @@
        git-version-gen
 
 dist-hook:
+       @if ! git diff --quiet; then echo "Uncommitted changes present; not 
releasing"; exit 1; fi
        echo $(VERSION) > $(distdir)/.tarball-version
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libusbmuxd-2.1.0/Makefile.in 
new/libusbmuxd-2.1.1/Makefile.in
--- old/libusbmuxd-2.1.0/Makefile.in    2024-03-27 02:36:20.000000000 +0100
+++ new/libusbmuxd-2.1.1/Makefile.in    2025-06-04 15:35:38.000000000 +0200
@@ -849,6 +849,7 @@
 
 
 dist-hook:
+       @if ! git diff --quiet; then echo "Uncommitted changes present; not 
releasing"; exit 1; fi
        echo $(VERSION) > $(distdir)/.tarball-version
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libusbmuxd-2.1.0/NEWS new/libusbmuxd-2.1.1/NEWS
--- old/libusbmuxd-2.1.0/NEWS   2024-03-27 02:35:07.000000000 +0100
+++ new/libusbmuxd-2.1.1/NEWS   2025-06-04 15:00:41.000000000 +0200
@@ -1,3 +1,14 @@
+Version 2.1.1
+~~~~~~~~~~~~~
+
+* Changes:
+  - tools: Fix potential issue with select() in case the network fd is higher 
than the usbmux fd
+  - Switch to better initializer strategy
+  - Fix compilation on MSVC
+  - iproxy: Make sure to print correct socket error messages
+  - inetcat: Make sure to report correct error messages
+
+
 Version 2.1.0
 ~~~~~~~~~~~~~
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libusbmuxd-2.1.0/README.md 
new/libusbmuxd-2.1.1/README.md
--- old/libusbmuxd-2.1.0/README.md      2024-03-27 02:31:42.000000000 +0100
+++ new/libusbmuxd-2.1.1/README.md      2024-10-22 19:36:45.000000000 +0200
@@ -258,8 +258,8 @@
 ## Links
 
 * Homepage: https://libimobiledevice.org/
-* Repository: https://git.libimobiledevice.org/libusbmuxd.git
-* Repository (Mirror): https://github.com/libimobiledevice/libusbmuxd.git
+* Repository: https://github.com/libimobiledevice/libusbmuxd.git
+* Repository (Mirror): https://git.libimobiledevice.org/libusbmuxd.git
 * Issue Tracker: https://github.com/libimobiledevice/libusbmuxd/issues
 * Mailing List: 
https://lists.libimobiledevice.org/mailman/listinfo/libimobiledevice-devel
 * Twitter: https://twitter.com/libimobiledev
@@ -279,4 +279,4 @@
 This project is an independent software library and has not been authorized,
 sponsored, or otherwise approved by Apple Inc.
 
-README Updated on: 2024-03-27
+README Updated on: 2024-10-22
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libusbmuxd-2.1.0/config.h.in 
new/libusbmuxd-2.1.1/config.h.in
--- old/libusbmuxd-2.1.0/config.h.in    2024-03-27 02:16:55.000000000 +0100
+++ new/libusbmuxd-2.1.1/config.h.in    2025-06-04 15:35:48.000000000 +0200
@@ -36,9 +36,6 @@
 /* Define to 1 if you have the 'realloc' function. */
 #undef HAVE_REALLOC
 
-/* Define to 1 if you have the 'sleep' function. */
-#undef HAVE_SLEEP
-
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libusbmuxd-2.1.0/configure 
new/libusbmuxd-2.1.1/configure
--- old/libusbmuxd-2.1.0/configure      2024-03-27 02:36:21.000000000 +0100
+++ new/libusbmuxd-2.1.1/configure      2025-06-04 15:35:39.000000000 +0200
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.72 for libusbmuxd 2.1.0.
+# Generated by GNU Autoconf 2.72 for libusbmuxd 2.1.1.
 #
 # Report bugs to <https://github.com/libimobiledevice/libusbmuxd/issues>.
 #
@@ -615,8 +615,8 @@
 # Identity of this package.
 PACKAGE_NAME='libusbmuxd'
 PACKAGE_TARNAME='libusbmuxd'
-PACKAGE_VERSION='2.1.0'
-PACKAGE_STRING='libusbmuxd 2.1.0'
+PACKAGE_VERSION='2.1.1'
+PACKAGE_STRING='libusbmuxd 2.1.1'
 PACKAGE_BUGREPORT='https://github.com/libimobiledevice/libusbmuxd/issues'
 PACKAGE_URL='https://libimobiledevice.org'
 
@@ -1374,7 +1374,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-'configure' configures libusbmuxd 2.1.0 to adapt to many kinds of systems.
+'configure' configures libusbmuxd 2.1.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1445,7 +1445,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libusbmuxd 2.1.0:";;
+     short | recursive ) echo "Configuration of libusbmuxd 2.1.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1572,7 +1572,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libusbmuxd configure 2.1.0
+libusbmuxd configure 2.1.1
 generated by GNU Autoconf 2.72
 
 Copyright (C) 2023 Free Software Foundation, Inc.
@@ -1953,7 +1953,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libusbmuxd $as_me 2.1.0, which was
+It was created by libusbmuxd $as_me 2.1.1, which was
 generated by GNU Autoconf 2.72.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -3245,7 +3245,7 @@
 
 # Define the identity of the package.
  PACKAGE='libusbmuxd'
- VERSION='2.1.0'
+ VERSION='2.1.1'
 
 
 printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -3400,7 +3400,7 @@
 #                 changes to the signature and the semantic)
 #  ? :+1 : ?   == just internal changes
 # CURRENT : REVISION : AGE
-LIBUSBMUXD_SO_VERSION=7:0:0
+LIBUSBMUXD_SO_VERSION=7:1:0
 
 
 
@@ -13551,12 +13551,6 @@
   printf "%s\n" "#define HAVE_STPNCPY 1" >>confdefs.h
 
 fi
-ac_fn_c_check_func "$LINENO" "sleep" "ac_cv_func_sleep"
-if test "x$ac_cv_func_sleep" = xyes
-then :
-  printf "%s\n" "#define HAVE_SLEEP 1" >>confdefs.h
-
-fi
 ac_fn_c_check_func "$LINENO" "malloc" "ac_cv_func_malloc"
 if test "x$ac_cv_func_malloc" = xyes
 then :
@@ -15435,7 +15429,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by libusbmuxd $as_me 2.1.0, which was
+This file was extended by libusbmuxd $as_me 2.1.1, which was
 generated by GNU Autoconf 2.72.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -15504,7 +15498,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
-libusbmuxd config.status 2.1.0
+libusbmuxd config.status 2.1.1
 configured by $0, generated by GNU Autoconf 2.72,
   with options \\"\$ac_cs_config\\"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libusbmuxd-2.1.0/configure.ac 
new/libusbmuxd-2.1.1/configure.ac
--- old/libusbmuxd-2.1.0/configure.ac   2024-03-27 02:16:48.000000000 +0100
+++ new/libusbmuxd-2.1.1/configure.ac   2025-06-04 15:01:03.000000000 +0200
@@ -15,7 +15,7 @@
 #                 changes to the signature and the semantic)
 #  ? :+1 : ?   == just internal changes
 # CURRENT : REVISION : AGE
-LIBUSBMUXD_SO_VERSION=7:0:0
+LIBUSBMUXD_SO_VERSION=7:1:0
 
 AC_SUBST(LIBUSBMUXD_SO_VERSION)
 
@@ -69,7 +69,7 @@
 AC_TYPE_UINT8_T
 
 # Checks for library functions.
-AC_CHECK_FUNCS([strcasecmp strdup strerror stpncpy sleep malloc realloc 
getifaddrs])
+AC_CHECK_FUNCS([strcasecmp strdup strerror stpncpy malloc realloc getifaddrs])
 
 # Check for operating system
 AC_MSG_CHECKING([for platform-specific build settings])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libusbmuxd-2.1.0/include/usbmuxd-proto.h 
new/libusbmuxd-2.1.1/include/usbmuxd-proto.h
--- old/libusbmuxd-2.1.0/include/usbmuxd-proto.h        2018-02-05 
23:56:40.000000000 +0100
+++ new/libusbmuxd-2.1.1/include/usbmuxd-proto.h        2024-11-29 
04:26:45.000000000 +0100
@@ -26,7 +26,7 @@
 #include <stdint.h>
 #define USBMUXD_PROTOCOL_VERSION 0
 
-#if defined(WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32) || defined(__CYGWIN__)
 #define USBMUXD_SOCKET_PORT 27015
 #else
 #define USBMUXD_SOCKET_FILE "/var/run/usbmuxd"
@@ -57,28 +57,30 @@
        MESSAGE_PLIST = 8,
 };
 
+#pragma pack(push, 1)
+
 struct usbmuxd_header {
        uint32_t length;    // length of message, including header
        uint32_t version;   // protocol version
        uint32_t message;   // message type
        uint32_t tag;       // responses to this query will echo back this tag
-} __attribute__((__packed__));
+};
 
 struct usbmuxd_result_msg {
        struct usbmuxd_header header;
        uint32_t result;
-} __attribute__((__packed__));
+};
 
 struct usbmuxd_connect_request {
        struct usbmuxd_header header;
        uint32_t device_id;
        uint16_t port;   // TCP port number
        uint16_t reserved;   // set to zero
-} __attribute__((__packed__));
+};
 
 struct usbmuxd_listen_request {
        struct usbmuxd_header header;
-} __attribute__((__packed__));
+};
 
 struct usbmuxd_device_record {
        uint32_t device_id;
@@ -86,7 +88,9 @@
        char serial_number[256];
        uint16_t padding;
        uint32_t location;
-} __attribute__((__packed__));
+};
+
+#pragma pack(pop)
 
 #ifdef __cplusplus
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libusbmuxd-2.1.0/src/libusbmuxd.c 
new/libusbmuxd-2.1.1/src/libusbmuxd.c
--- old/libusbmuxd-2.1.0/src/libusbmuxd.c       2024-03-27 02:13:08.000000000 
+0100
+++ new/libusbmuxd-2.1.1/src/libusbmuxd.c       2025-01-01 17:30:12.000000000 
+0100
@@ -51,16 +51,13 @@
 #define ECONNREFUSED 107
 #endif
 
-#include <unistd.h>
-#include <signal.h>
-
-#ifdef WIN32
+#ifdef _WIN32
 #include <winsock2.h>
 #include <windows.h>
-#ifndef HAVE_SLEEP
 #define sleep(x) Sleep(x*1000)
-#endif
 #else
+#include <unistd.h>
+#include <signal.h>
 #include <sys/socket.h>
 #include <arpa/inet.h>
 #if defined(HAVE_PROGRAM_INVOCATION_SHORT_NAME) && 
!defined(HAVE_PROGRAM_INVOCATION_SHORT_NAME_ERRNO_H)
@@ -93,8 +90,11 @@
 }
 #endif
 
+#ifdef _MSC_VER
+#define strcasecmp _stricmp
+#endif
+
 #include <plist/plist.h>
-#define PLIST_CLIENT_VERSION_STRING PACKAGE_STRING
 #define PLIST_LIBUSBMUX_VERSION 3
 
 static char *bundle_id = NULL;
@@ -115,6 +115,9 @@
 #ifndef PACKAGE
 #define PACKAGE "libusbmuxd"
 #endif
+#ifndef PACKAGE_NAME
+#define PACKAGE_NAME PACKAGE
+#endif
 #define LIBUSBMUXD_DEBUG(level, format, ...) if (level <= libusbmuxd_debug) 
fprintf(stderr, ("[" PACKAGE "] " format), __VA_ARGS__); fflush(stderr);
 #define LIBUSBMUXD_ERROR(format, ...) LIBUSBMUXD_DEBUG(0, format, __VA_ARGS__)
 
@@ -164,7 +167,7 @@
        char *usbmuxd_socket_addr = getenv("USBMUXD_SOCKET_ADDRESS");
        if (usbmuxd_socket_addr) {
                if (strncmp(usbmuxd_socket_addr, "UNIX:", 5) == 0) {
-#if defined(WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32) || defined(__CYGWIN__)
                        /* not supported, ignore */
 #else
                        if (usbmuxd_socket_addr[5] != '\0') {
@@ -215,7 +218,7 @@
                        }
                }
        }
-#if defined(WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32) || defined(__CYGWIN__)
        res = socket_connect("127.0.0.1", USBMUXD_SOCKET_PORT);
 #else
        res = socket_connect_unix(USBMUXD_SOCKET_FILE);
@@ -660,7 +663,7 @@
        if (pname) {
                prog_name = strdup(pname);
        }
-#elif defined (WIN32)
+#elif defined (_WIN32)
        TCHAR *_pname = malloc((MAX_PATH+1) * sizeof(TCHAR));
        if (GetModuleFileName(NULL, _pname, MAX_PATH+1) > 0) {
                char* pname = NULL;
@@ -721,6 +724,8 @@
 
 static plist_t create_plist_message(const char* message_type)
 {
+       char client_version[128];
+       snprintf(client_version, 128, PACKAGE_NAME " %s", libusbmuxd_version());
        if (!bundle_id) {
                get_bundle_id();
        }
@@ -731,7 +736,7 @@
        if (bundle_id) {
                plist_dict_set_item(plist, "BundleID", 
plist_new_string(bundle_id));
        }
-       plist_dict_set_item(plist, "ClientVersionString", 
plist_new_string(PLIST_CLIENT_VERSION_STRING));
+       plist_dict_set_item(plist, "ClientVersionString", 
plist_new_string(client_version));
        plist_dict_set_item(plist, "MessageType", 
plist_new_string(message_type));
        if (prog_name) {
                plist_dict_set_item(plist, "ProgName", 
plist_new_string(prog_name));
@@ -1593,7 +1598,7 @@
        if (num_sent < 0) {
                *sent_bytes = 0;
                LIBUSBMUXD_DEBUG(1, "%s: Error %d when sending: %s\n", 
__func__, -num_sent, strerror(-num_sent));
-               return -num_sent;
+               return num_sent;
        }
 
        if ((uint32_t)num_sent < len) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libusbmuxd-2.1.0/tools/inetcat.c 
new/libusbmuxd-2.1.1/tools/inetcat.c
--- old/libusbmuxd-2.1.0/tools/inetcat.c        2022-05-05 00:50:42.000000000 
+0200
+++ new/libusbmuxd-2.1.1/tools/inetcat.c        2025-02-16 23:48:19.000000000 
+0100
@@ -31,15 +31,18 @@
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
-#include <fcntl.h>
 #include <stddef.h>
-#include <unistd.h>
 #include <errno.h>
-#include <getopt.h>
-#ifdef WIN32
+
+#ifdef _WIN32
 #include <winsock2.h>
 #include <windows.h>
+#ifndef _MSC_VER
+#include <unistd.h>
+#endif
 #else
+#include <fcntl.h>
+#include <unistd.h>
 #include <sys/select.h>
 #include <sys/socket.h>
 #include <sys/un.h>
@@ -47,14 +50,22 @@
 #include <signal.h>
 #endif
 
-#include "usbmuxd.h"
+#ifdef _MSC_VER
+#include <basetsd.h>
+typedef SSIZE_T ssize_t;
+#define STDIN_FILENO  _fileno(stdin)
+#define STDOUT_FILENO _fileno(stdout)
+#endif
+
+#include <getopt.h>
 #include <libimobiledevice-glue/socket.h>
+#include "usbmuxd.h"
 
 static int debug_level = 0;
 
 static size_t read_data_socket(int fd, uint8_t* buf, size_t bufsize)
 {
-#ifdef WIN32
+#ifdef _WIN32
     u_long bytesavailable = 0;
     if (fd == STDIN_FILENO) {
         bytesavailable = bufsize;
@@ -140,7 +151,7 @@
             print_usage(argc, argv, 0);
             return 0;
         case 'v':
-            printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+            printf("%s %s\n", TOOL_NAME, libusbmuxd_version());
             return 0;
         default:
             print_usage(argc, argv, 1);
@@ -166,7 +177,7 @@
         return -EINVAL;
     }
 
-#ifndef WIN32
+#ifndef _WIN32
     signal(SIGPIPE, SIG_IGN);
 #endif
 
@@ -241,12 +252,15 @@
             fprintf(stderr, "Failed to convert network address: %d (%s)\n", 
errno, strerror(errno));
         }
        devfd = socket_connect_addr(saddr, device_port);
+        if (devfd < 0) {
+            devfd = -errno;
+        }
     } else if (dev->conn_type == CONNECTION_TYPE_USB) {
         devfd = usbmuxd_connect(dev->handle, device_port);
     }
     free(dev_list);
     if (devfd < 0) {
-        fprintf(stderr, "Error connecting to device: %s\n", strerror(errno));
+        fprintf(stderr, "Error connecting to device: %s\n", strerror(-devfd));
         return 1;
     }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libusbmuxd-2.1.0/tools/iproxy.c 
new/libusbmuxd-2.1.1/tools/iproxy.c
--- old/libusbmuxd-2.1.0/tools/iproxy.c 2024-03-27 02:12:00.000000000 +0100
+++ new/libusbmuxd-2.1.1/tools/iproxy.c 2025-02-13 11:16:02.000000000 +0100
@@ -32,20 +32,22 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <fcntl.h>
 #include <stddef.h>
-#include <unistd.h>
 #include <errno.h>
-#include <getopt.h>
-#ifdef WIN32
+
+#ifdef _WIN32
 #include <winsock2.h>
 #include <windows.h>
 typedef unsigned int socklen_t;
 #else
+#include <fcntl.h>
+#include <unistd.h>
 #include <sys/select.h>
 #include <sys/socket.h>
 #include <signal.h>
 #endif
+
+#include <getopt.h>
 #include <libimobiledevice-glue/socket.h>
 #include <libimobiledevice-glue/thread.h>
 #include "usbmuxd.h"
@@ -156,6 +158,9 @@
                }
                fprintf(stdout, "Requesting connection to NETWORK device %s 
(serial: %s), port %d\n", addrtxt, dev->udid, cdata->device_port);
                cdata->sfd = socket_connect_addr(saddr, cdata->device_port);
+               if (cdata->sfd < 0) {
+                       cdata->sfd = -errno;
+               }
        } else if (dev->conn_type == CONNECTION_TYPE_USB) {
                fprintf(stdout, "Requesting connection to USB device handle %d 
(serial: %s), port %d\n", dev->handle, dev->udid, cdata->device_port);
 
@@ -163,16 +168,17 @@
        }
        free(dev_list);
        if (cdata->sfd < 0) {
-               fprintf(stderr, "Error connecting to device: %s\n", 
strerror(errno));
+               fprintf(stderr, "Error connecting to device: %s\n", 
strerror(-cdata->sfd));
        } else {
                fd_set fds;
                FD_ZERO(&fds);
                FD_SET(cdata->fd, &fds);
                FD_SET(cdata->sfd, &fds);
+               int maxfd = cdata->fd > cdata->sfd ? cdata->fd : cdata->sfd;
 
                while (1) {
                        fd_set read_fds = fds;
-                       int ret_sel = select(cdata->sfd+1, &read_fds, NULL, 
NULL, NULL);
+                       int ret_sel = select(maxfd+1, &read_fds, NULL, NULL, 
NULL);
                        if (ret_sel < 0) {
                                perror("select");
                                break;
@@ -300,7 +306,7 @@
                        print_usage(argc, argv, 0);
                        return 0;
                case 'v':
-                       printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+                       printf("%s %s\n", TOOL_NAME, libusbmuxd_version());
                        return 0;
                default:
                        print_usage(argc, argv, 1);
@@ -331,7 +337,7 @@
                        fprintf(stderr, "Invalid listen port specified in 
argument '%s'!\n", argv[0]);
                        free(device_udid);
                        free(source_addr);
-                       return -EINVAL;
+                       return EINVAL;
                }
                endp = NULL;
                device_port[0] = (uint16_t)strtol(argv[1], &endp, 10);
@@ -339,7 +345,7 @@
                        fprintf(stderr, "Invalid device port specified in 
argument '%s'!\n", argv[1]);
                        free(device_udid);
                        free(source_addr);
-                       return -EINVAL;
+                       return EINVAL;
                }
                num_pairs = 1;
        } else {
@@ -351,14 +357,14 @@
                                fprintf(stderr, "Invalid listen port specified 
in argument '%s'!\n", argv[i]);
                                free(device_udid);
                                free(source_addr);
-                               return -EINVAL;
+                               return EINVAL;
                        }
                        device_port[i] = (uint16_t)strtol(endp+1, &endp, 10);
                        if (!device_port[i] || (*endp != '\0')) {
                                fprintf(stderr, "Invalid device port specified 
in argument '%s'!\n", argv[i+1]);
                                free(device_udid);
                                free(source_addr);
-                               return -EINVAL;
+                               return EINVAL;
                        }
                }
                num_pairs = argc;
@@ -366,10 +372,10 @@
 
        if (num_pairs > 16) {
                fprintf(stderr, "ERROR: Too many LOCAL:DEVICE port pairs. 
Maximum is 16.\n");
-               return -1;
+               return 1;
        }
 
-#ifndef WIN32
+#ifndef _WIN32
        signal(SIGPIPE, SIG_IGN);
 #endif
 
@@ -386,7 +392,7 @@
                                for (j = num_listen; j >= 0; j--) {
                                        socket_close(listen_sock[j].fd);
                                }
-                               return -errno;
+                               return 1;
                        }
                        listen_sock[num_listen].index = i;
                        num_listen++;
@@ -400,7 +406,7 @@
                                for (j = num_listen; j >= 0; j--) {
                                        socket_close(listen_sock[j].fd);
                                }
-                               return -errno;
+                               return 1;
                        }
                        listen_sock[num_listen].index = i;
                        num_listen++;
@@ -411,7 +417,7 @@
        fd_set fds;
        FD_ZERO(&fds);
        for (i = 0; i < num_listen; i++) {
-#ifdef WIN32
+#ifdef _WIN32
                u_long l_yes = 1;
                ioctlsocket(listen_sock[i].fd, FIONBIO, &l_yes);
 #else
@@ -445,7 +451,7 @@
                                        socket_close(c_sock);
                                        fprintf(stderr, "ERROR: Out of 
memory\n");
                                        free(device_udid);
-                                       return -1;
+                                       return 1;
                                }
                                cdata->fd = c_sock;
                                cdata->sfd = -1;

Reply via email to