From 1b2a0d7913847fe0fc680b02dc31bf4e25e5941e Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Mon, 12 Feb 2024 19:59:46 +0100 Subject: [PATCH] Handle more systems which lack support for the scanf m modifier The 'm' modifier for scanf is an extension to ISO C. It was mentioned in POSIX 1003.1 2008 (Issue 7). It is difficult to detect at compile time if a libc has implemented support for this modifier. Extend the existing list of systems which lack support for it with NetBSD and Dragonfly BSD. Signed-off-by: Olaf Hering --- src/plugins/managesieve/sieve_prefs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/managesieve/sieve_prefs.c b/src/plugins/managesieve/sieve_prefs.c index 9e30b499d..913d308b4 100644 --- a/src/plugins/managesieve/sieve_prefs.c +++ b/src/plugins/managesieve/sieve_prefs.c @@ -477,8 +477,8 @@ struct SieveAccountConfig *sieve_prefs_account_get_config( guchar tls_type, auth, auth_type; gsize len; gint num; -#if defined(G_OS_WIN32) || defined(__OpenBSD__) || defined(__FreeBSD__) - /* Non-GNU sscanf() does not understand the %ms format, so we +#if defined(G_OS_WIN32) || defined(__DragonFly__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__FreeBSD__) + /* Some libc variants lack support for the ISO C extension %ms, so we * have to do the allocation of target buffer ourselves before * calling sscanf(), and copy the host string to config->host. */ @@ -503,13 +503,13 @@ struct SieveAccountConfig *sieve_prefs_account_get_config( enc_userid[0] = '\0'; enc_passwd[0] = '\0'; -#if defined(G_OS_WIN32) || defined(__OpenBSD__) || defined(__FreeBSD__) +#if defined(G_OS_WIN32) || defined(__DragonFly__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__FreeBSD__) if ((num = sscanf(confstr, "%c%c %255s %c%hu %hhu %hhu %hhu %255s %255s", #else if ((num = sscanf(confstr, "%c%c %ms %c%hu %hhu %hhu %hhu %255s %255s", #endif &enable, &use_host, -#if defined(G_OS_WIN32) || defined(__OpenBSD__) || defined(__FreeBSD__) +#if defined(G_OS_WIN32) || defined(__DragonFly__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__FreeBSD__) tmphost, #else &config->host, @@ -539,7 +539,7 @@ struct SieveAccountConfig *sieve_prefs_account_get_config( config->auth = auth; config->auth_type = auth_type; -#if defined(G_OS_WIN32) || defined(__OpenBSD__) || defined(__FreeBSD__) +#if defined(G_OS_WIN32) || defined(__DragonFly__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__FreeBSD__) config->host = g_strndup(tmphost, 255); #endif -- 2.11.4.GIT