[3.0] ceda65d Clean up VSM setup if mmap fails

Tollef Fog Heen tfheen at varnish-cache.org
Tue Aug 30 10:31:43 CEST 2011


commit ceda65ddc3d0622d5a7224399131d15cc6dc4a1b
Author: Rogier R. Mulhuijzen <varnish at bsdchicks.com>
Date:   Tue Aug 30 10:25:51 2011 +0200

    Clean up VSM setup if mmap fails
    
    Fixes #995 (the rest of it).

diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c
index 79cf5e5..efb7592 100644
--- a/lib/libvarnishapi/vsm.c
+++ b/lib/libvarnishapi/vsm.c
@@ -188,6 +188,9 @@ vsm_open(struct VSM_data *vd, int diag)
 		if (diag)
 			vd->diag(vd->priv, "Cannot mmap %s: %s\n",
 			    vd->fname, strerror(errno));
+		AZ(close(vd->vsm_fd));
+		vd->vsm_fd = -1;
+		vd->VSM_head = NULL;
 		return (1);
 	}
 	vd->vsm_end = (uint8_t *)vd->VSM_head + slh.shm_size;



More information about the varnish-commit mailing list