Call for testing: OpenSSH 6.7

Damien Miller djm at mindrot.org
Thu Aug 21 11:00:53 EST 2014


On Wed, 20 Aug 2014, Tom Christensen wrote:

> (gdb) p __progname
> $1 = 0x0
> (gdb)
> 
> test_helper.c should probably use ssh_get_progname() from bsd-misc.c.

Thanks for figuring this out. I'd prefer to keep the dependencies from
the tests to a minimum, at least until we have the API defined in
libopenssh, so here's a workaround that uses argv[0]:

Index: regress/unittests/test_helper/test_helper.c
===================================================================
RCS file: /var/cvs/openssh/regress/unittests/test_helper/test_helper.c,v
retrieving revision 1.3
diff -u -p -r1.3 test_helper.c
--- regress/unittests/test_helper/test_helper.c	11 Jun 2014 19:32:30 -0000	1.3
+++ regress/unittests/test_helper/test_helper.c	21 Aug 2014 00:59:02 -0000
@@ -117,6 +117,19 @@ main(int argc, char **argv)
 {
 	int ch;
 
+	/* Handle systems without __progname */
+	if (__progname == NULL) {
+		__progname = strrchr(argv[0], '/');
+		if (__progname == NULL || __progname[1] == '\0')
+			__progname = argv[0];	
+		else
+			__progname++;
+		if ((__progname = strdup(__progname)) == NULL) {
+			fprintf(stderr, "strdup failed\n");
+			exit(1);
+		}
+	}
+
 	while ((ch = getopt(argc, argv, "vqd:")) != -1) {
 		switch (ch) {
 		case 'd':


More information about the openssh-unix-dev mailing list