- (djm) [regress/unittests/test_helper/test_helper.c] Fix for systems that
don't set __progname. Diagnosed by Tom Christensen.
diff --git a/ChangeLog b/ChangeLog
index 8f78d23..d9f507d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
20140821
- (djm) [Makefile.in] fix reference to libtest_helper.a in sshkey test too.
- (djm) [key.h] Fix ifdefs for no-ECC OpenSSL
+ - (djm) [regress/unittests/test_helper/test_helper.c] Fix for systems that
+ don't set __progname. Diagnosed by Tom Christensen.
20140820
- (djm) [configure.ac] Check OpenSSL version is supported at configure time;
diff --git a/regress/unittests/test_helper/test_helper.c b/regress/unittests/test_helper/test_helper.c
index 6faf99e..d0bc678 100644
--- a/regress/unittests/test_helper/test_helper.c
+++ b/regress/unittests/test_helper/test_helper.c
@@ -117,6 +117,19 @@
{
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':