[master] 5d97901af mgt_jail: Make error reporting more consistent

Nils Goroll nils.goroll at uplex.de
Thu Feb 13 20:02:07 UTC 2025


commit 5d97901af726de70a9532758324d6e4d04406a5b
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Feb 13 20:51:24 2025 +0100

    mgt_jail: Make error reporting more consistent
    
    Fixes #4273

diff --git a/bin/varnishd/common/heritage.h b/bin/varnishd/common/heritage.h
index 043343bbc..aedc7c295 100644
--- a/bin/varnishd/common/heritage.h
+++ b/bin/varnishd/common/heritage.h
@@ -105,13 +105,18 @@ extern struct heritage heritage;
 /* Really belongs in mgt.h, but storage_file chokes on both */
 void MCH_Fd_Inherit(int fd, const char *what);
 
-#define ARGV_ERR(...)						\
+#define ARGV_EXIT						\
 	do {							\
-		fprintf(stderr, "Error: " __VA_ARGS__);		\
 		fprintf(stderr, "(-? gives usage)\n");		\
 		exit(2);					\
 	} while (0)
 
+#define ARGV_ERR(...)						\
+	do {							\
+		fprintf(stderr, "Error: " __VA_ARGS__);		\
+		ARGV_EXIT;					\
+	} while (0)
+
 /* cache/cache_main.c */
 void child_main(int, size_t);
 
diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index d67acac69..2fbcfccad 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -879,8 +879,7 @@ main(int argc, char * const *argv)
 	openlog("varnishd", LOG_PID, LOG_LOCAL0);
 
 	if (VJ_make_workdir(workdir))
-		ARGV_ERR("Cannot create working directory (%s): %s\n",
-		    workdir, VAS_errtxt(errno));
+		ARGV_EXIT;
 
 	VJ_master(JAIL_MASTER_SYSTEM);
 #ifdef RLIMIT_MEMLOCK


More information about the varnish-commit mailing list