]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
When running on Windows, the default OS value should be 'win'
authorDaniel Lenski <dlenski@gmail.com>
Wed, 15 Dec 2021 01:06:50 +0000 (17:06 -0800)
committerDaniel Lenski <dlenski@gmail.com>
Wed, 15 Dec 2021 17:07:02 +0000 (09:07 -0800)
This makes the behavior on Windows consistent with other platforms.

Also attempt to detect iOS, and set the default OS value to 'apple-ios'
there. As far as we know, no one has built LibOpenConnect on iOS (see
https://gitlab.com/openconnect/openconnect/-/issues/163), but this should
help future-proof it.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
library.c

index d4f4683871b287cffa234eb278fa66773607b4f3..a06ba6afc239e96e1f5ab26efe4befdbf6f4b4f8 100644 (file)
--- a/library.c
+++ b/library.c
@@ -382,9 +382,20 @@ int openconnect_set_reported_os(struct openconnect_info *vpninfo,
 
        if (!os) {
 #if defined(__APPLE__)
+#  include <TargetConditionals.h>
+#  if TARGET_OS_IOS
+               /* We need to use Apple's boolean "target" defines to distinguish iOS from
+                * desktop MacOS. See  https://stackoverflow.com/a/5920028 and
+                * https://github.com/mstg/iOS-full-sdk/blob/master/iPhoneOS9.3.sdk/usr/include/TargetConditionals.h#L64-L71
+                */
+               os = "apple-ios";
+#  else
                os = "mac-intel";
+#  endif
 #elif defined(__ANDROID__)
                os = "android";
+#elif defined(_WIN32)
+               os = "win";
 #else
                os = sizeof(long) > 4 ? "linux-64" : "linux";
 #endif