[master] 8488a8b Clean up VSM setup if mmap fails

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


commit 8488a8b27a485b763d1df95f44045fb4e1a18a61
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