[master] 3ed6c35 Minor polish while here anyway

Poul-Henning Kamp phk at FreeBSD.org
Mon Sep 12 08:17:09 CEST 2016


commit 3ed6c35b63b9684accce2ce5fe6d156bc9d679e4
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Sep 12 06:16:27 2016 +0000

    Minor polish while here anyway

diff --git a/bin/varnishd/mgt/mgt.h b/bin/varnishd/mgt/mgt.h
index 1877424..590372d 100644
--- a/bin/varnishd/mgt/mgt.h
+++ b/bin/varnishd/mgt/mgt.h
@@ -161,7 +161,7 @@ void mgt_SHM_Init(void);
 void mgt_SHM_static_alloc(const void *, ssize_t size,
     const char *class, const char *type, const char *ident);
 void mgt_SHM_Create(void);
-void mgt_SHM_Commit(void);
+int mgt_SHM_Commit(void);
 void mgt_SHM_Destroy(int keep);
 void mgt_SHM_Size_Adjust(void);
 
diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index 4508117..077363d 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -764,7 +764,9 @@ MGT_Run(void)
 		}
 	}
 
-	mgt_SHM_Commit();
+	i = mgt_SHM_Commit();
+	if (i != 0)
+		MGT_complain(C_ERR, "Could not commit SHM file");
 
 	i = vev_schedule(mgt_evb);
 	if (i != 0)
diff --git a/bin/varnishd/mgt/mgt_shmem.c b/bin/varnishd/mgt/mgt_shmem.c
index fe6a638..d760066 100644
--- a/bin/varnishd/mgt/mgt_shmem.c
+++ b/bin/varnishd/mgt/mgt_shmem.c
@@ -251,20 +251,22 @@ mgt_SHM_Create(void)
  * Commit the VSM
  */
 
-void
+int
 mgt_SHM_Commit(void)
 {
 	char fnbuf[64];
+	int retval = 0;
 
 	bprintf(fnbuf, "%s.%jd", VSM_FILENAME, (intmax_t)getpid());
 	VJ_master(JAIL_MASTER_FILE);
 	if (rename(fnbuf, VSM_FILENAME)) {
-		fprintf(stderr, "Rename failed %s -> %s: %s\n",
+		MGT_complain(C_ERR, "Rename failed %s -> %s: %s\n",
 		    fnbuf, VSM_FILENAME, strerror(errno));
 		(void)unlink(fnbuf);
-		exit(1);
+		retval = -1;
 	}
 	VJ_master(JAIL_MASTER_LOW);
+	return (retval);
 }
 
 /*--------------------------------------------------------------------



More information about the varnish-commit mailing list