[4.1] 90828d7 Minor polish while here anyway

PÃ¥l Hermunn Johansen hermunn at varnish-software.com
Tue Sep 13 13:07:11 CEST 2016


commit 90828d774a0a8667d9659fc490dea421365879d4
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 4e0e7bc..e59ec7f 100644
--- a/bin/varnishd/mgt/mgt.h
+++ b/bin/varnishd/mgt/mgt.h
@@ -150,7 +150,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 3ac39a0..6e61306 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -742,7 +742,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 9345d38..7d941ee 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