[master] f04d7df6e vtest: put cwd on the stack

Nils Goroll nils.goroll at uplex.de
Thu Oct 15 10:06:06 UTC 2020


commit f04d7df6e6d5b350740e01d24749a3930390b7a0
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Oct 15 12:01:35 2020 +0200

    vtest: put cwd on the stack
    
    0051cbe3b9cc24586e0ad99cff72041c6df944b8 did not work on
    solaris-descendents, the man page clearly states that the size argument
    also determines the buffer to be malloc()ed for a NULL buffer argument.

diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index 3c3887450..1b322f8de 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -686,6 +686,7 @@ main(int argc, char * const *argv)
 	int use_cleaner = 0;
 	uintmax_t bufsiz;
 	const char *p;
+	char buf[PATH_MAX];
 
 	argv0 = strrchr(argv[0], '/');
 	if (argv0 == NULL)
@@ -698,7 +699,7 @@ main(int argc, char * const *argv)
 	else
 		tmppath = strdup("/tmp");
 
-	cwd = getcwd(NULL, 0);
+	cwd = getcwd(buf, sizeof buf);
 	extmacro_def("pwd", "%s", cwd);
 
 	vmod_path = NULL;


More information about the varnish-commit mailing list