From eb0fa46537ffa39e73c8dc2a174af8083797aec0 Mon Sep 17 00:00:00 2001 From: Daniel Lenski Date: Tue, 14 Dec 2021 17:06:50 -0800 Subject: [PATCH] When running on Windows, the default OS value should be 'win' 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 --- library.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/library.c b/library.c index d4f46838..a06ba6af 100644 --- 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 +# 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 -- 2.50.1