php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #68024
Patch master-fpm-append-settings.patch revision 2014-09-16 08:51 UTC by manuel-php at mausz dot at

Patch master-fpm-append-settings.patch for FPM related Bug #68024

Patch version 2014-09-16 08:51 UTC

Return to Bug #68024 | Download this patch
Patch Revisions:

Developer: manuel-php@mausz.at

--- fpm_conf.c.orig	2014-09-15 22:15:46.603108914 +0200
+++ fpm_conf.c	2014-09-16 01:24:38.483456190 +0200
@@ -541,7 +541,7 @@
 static char *fpm_conf_set_array(zval *key, zval *value, void **config, int convert_to_bool) /* {{{ */
 {
 	struct key_value_s *kv;
-	struct key_value_s ***parent = (struct key_value_s ***) config;
+	struct key_value_s ***head = (struct key_value_s ***) config;
 	int b;
 	void *subconf = &b;
 
@@ -580,8 +580,18 @@
 		return "fpm_conf_set_array: strdup(value) failed";
 	}
 
-	kv->next = **parent;
-	**parent = kv;
+	/* add the element to the end of the list
+	 * DON'T link the new tail to the head */
+	if (**head == NULL) {
+		kv->prev = kv;
+		kv->next = NULL;
+		**head = kv;
+	} else {
+		kv->next = NULL;
+		kv->prev = (**head)->prev;
+		(**head)->prev->next = kv;
+		(**head)->prev = kv;
+	}
 	return NULL;
 }
 /* }}} */
--- fpm_conf.h.orig	2014-09-16 01:23:19.042158473 +0200
+++ fpm_conf.h	2014-09-16 01:23:46.047599620 +0200
@@ -16,6 +16,7 @@
 
 struct key_value_s {
 	struct key_value_s *next;
+	struct key_value_s *prev;
 	char *key;
 	char *value;
 };
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Nov 29 08:01:23 2020 UTC