summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2014-08-21 15:54:50 +1000
committerDamien Miller <djm@mindrot.org>2014-08-21 15:54:50 +1000
commit4f1ff1ed782117f5d5204d4e91156ed5da07cbb7 (patch)
tree586f1a12f47b26c81057a4a6a3019c6578ad9c9f
parent005a64da0f457410045ef0bfa93c863c2450447d (diff)
downloadopenssh-git-4f1ff1ed782117f5d5204d4e91156ed5da07cbb7.tar.gz
- (djm) [regress/unittests/test_helper/test_helper.c] Fix for systems that
don't set __progname. Diagnosed by Tom Christensen.
-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':