[6.0] 866eb9dd0 create a char * argument for umem_cache_create()

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Aug 16 08:52:56 UTC 2018


commit 866eb9dd0715b923e7ea414495d75adb7903e294
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue May 8 10:09:54 2018 +0200

    create a char * argument for umem_cache_create()
    
    required after the constification in
    8f83087f333109ab12d82864b8e7ac98c132cf82
    
    I have no idea why the umem authors did not make this argument
    a const, they call strncpy on it

diff --git a/bin/varnishd/storage/storage_umem.c b/bin/varnishd/storage/storage_umem.c
index e36693974..ace90356e 100644
--- a/bin/varnishd/storage/storage_umem.c
+++ b/bin/varnishd/storage/storage_umem.c
@@ -392,6 +392,7 @@ static void v_matchproto_(storage_open_f)
 smu_open(struct stevedore *st)
 {
 	struct smu_sc *smu_sc;
+	char ident[strlen(st->ident) + 1];
 
 	ASSERT_CLI();
 	st->lru = LRU_Alloc();
@@ -405,7 +406,8 @@ smu_open(struct stevedore *st)
 
 	smu_open_init();
 
-	smu_sc->smu_cache = umem_cache_createf(st->ident,
+	AN(strcpy(ident, st->ident));
+	smu_sc->smu_cache = umem_cache_createf(ident,
 					  sizeof(struct smu),
 					  0,		// align
 					  smu_smu_constructor,


More information about the varnish-commit mailing list