summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--regress/unittests/test_helper/test_helper.c13
2 files changed, 15 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 8f78d23c..d9f507d4 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 6faf99e5..d0bc6783 100644
--- a/regress/unittests/test_helper/test_helper.c
+++ b/regress/unittests/test_helper/test_helper.c
@@ -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':