summaryrefslogtreecommitdiffstats
path: root/src/libutil/util.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-03-27 12:32:55 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-03-27 12:32:55 +0000
commit6c98a7447d79fda38e0eb8313d45c6cc23cfc3c9 (patch)
treeebeb8f6a6d5311fa8b451095a2b00c7c6b6b005c /src/libutil/util.c
parent2ad0276a3189c61e673ea716dbd461ac6ee59f87 (diff)
downloadrspamd-6c98a7447d79fda38e0eb8313d45c6cc23cfc3c9.tar.gz
rspamd-6c98a7447d79fda38e0eb8313d45c6cc23cfc3c9.zip
[Minor] Add older glib compat
Diffstat (limited to 'src/libutil/util.c')
-rw-r--r--src/libutil/util.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/libutil/util.c b/src/libutil/util.c
index d5ec57845..df10bf912 100644
--- a/src/libutil/util.c
+++ b/src/libutil/util.c
@@ -1487,6 +1487,29 @@ g_ptr_array_insert (GPtrArray *array, gint index_, gpointer data)
}
#endif
+#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 32))
+const gchar *
+g_environ_getenv (gchar **envp, const gchar *variable)
+{
+ gsize len;
+ gint i;
+
+ if (envp == NULL) {
+ return NULL;
+ }
+
+ len = strlen (variable);
+
+ for (i = 0; envp[i]; i++) {
+ if (strncmp (envp[i], variable, len) == 0 && envp[i][len] == '=') {
+ return envp[i] + len + 1;
+ }
+ }
+
+ return NULL;
+}
+#endif
+
gint
rspamd_fallocate (gint fd, off_t offset, off_t len)
{