diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2022-11-20 17:45:38 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2022-11-20 17:45:38 +0100 |
commit | 4db7d1d863cd41d200b8943980302f43967d25bf (patch) | |
tree | 92bb2e0b50eb390b3d03949ba081e5b9c13ff2af | |
parent | 915f3bcb59d12c0b61267c6899e186ee3096a5b1 (diff) | |
download | sciteco-4db7d1d863cd41d200b8943980302f43967d25bf.tar.gz |
fixed teco_qreg_table_set_environ() on Win32: sometimes keys unexpectedly begin with an equals character
* Has been observed on Windows Server 2008 with Glib 2.74.1-1, but not on the
Github CI runner.
-rw-r--r-- | src/qreg.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -909,7 +909,19 @@ teco_qreg_table_set_environ(teco_qreg_table_t *table, GError **error) g_auto(GStrv) env = g_get_environ(); for (gchar **key = env; *key; key++) { - gchar *value = strchr(*key, '='); + const gchar *p = *key; + + /* + * FIXME: On Win32, the key sometimes starts with `=` + * which shouldn't be possible and in reality it is a `!`. + * For instance `=C:=C:\msys64`. + */ +#ifdef G_OS_WIN32 + if (G_UNLIKELY(*p == '=')) + p++; +#endif + + gchar *value = strchr(p, '='); assert(value != NULL); *value++ = '\0'; |