From: Todd C. Miller Date: Tue, 28 Nov 2017 16:06:44 +0000 (-0700) Subject: Add missing initprogname() calls. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dd47a0a4165cf3e073cfe5f021e0d128f567627b;p=sudo Add missing initprogname() calls. --- diff --git a/lib/util/regress/fnmatch/fnm_test.c b/lib/util/regress/fnmatch/fnm_test.c index d35af2c79..1eb8bdc1a 100644 --- a/lib/util/regress/fnmatch/fnm_test.c +++ b/lib/util/regress/fnmatch/fnm_test.c @@ -17,6 +17,7 @@ #endif /* HAVE_STRINGS_H */ #include "sudo_compat.h" +#include "sudo_util.h" #ifdef HAVE_FNMATCH # include @@ -33,6 +34,8 @@ main(int argc, char *argv[]) char pattern[1024], string[1024], flagstr[1024]; int errors = 0, tests = 0, flags, got, want; + initprogname(argc > 0 ? argv[0] : "fnm_test"); + if (argc > 1) { if ((fp = fopen(argv[1], "r")) == NULL) { perror(argv[1]); diff --git a/lib/util/regress/glob/globtest.c b/lib/util/regress/glob/globtest.c index 27fe00fe3..988ae182e 100644 --- a/lib/util/regress/glob/globtest.c +++ b/lib/util/regress/glob/globtest.c @@ -23,6 +23,7 @@ #include #include "sudo_compat.h" +#include "sudo_util.h" #define MAX_RESULTS 256 @@ -45,6 +46,8 @@ main(int argc, char **argv) struct gl_entry entry; size_t len; + initprogname(argc > 0 ? argv[0] : "globtest"); + if (argc > 1) { if ((fp = fopen(argv[1], "r")) == NULL) { perror(argv[1]); diff --git a/plugins/sudoers/regress/env_match/check_env_pattern.c b/plugins/sudoers/regress/env_match/check_env_pattern.c index 70f2d3414..a8b1be4be 100644 --- a/plugins/sudoers/regress/env_match/check_env_pattern.c +++ b/plugins/sudoers/regress/env_match/check_env_pattern.c @@ -38,6 +38,8 @@ main(int argc, char *argv[]) char pattern[1024], string[1024]; int errors = 0, tests = 0, got, want; + initprogname(argc > 0 ? argv[0] : "check_env_pattern"); + if (argc > 1) { if ((fp = fopen(argv[1], "r")) == NULL) { perror(argv[1]); diff --git a/plugins/sudoers/regress/parser/check_base64.c b/plugins/sudoers/regress/parser/check_base64.c index 7af85bb97..34bfec388 100644 --- a/plugins/sudoers/regress/parser/check_base64.c +++ b/plugins/sudoers/regress/parser/check_base64.c @@ -34,6 +34,7 @@ #define SUDO_ERROR_WRAP 0 #include "sudo_compat.h" +#include "sudo_util.h" extern size_t base64_decode(const char *str, unsigned char *dst, size_t dsize); @@ -79,6 +80,8 @@ main(int argc, char *argv[]) unsigned char buf[32]; size_t len; + initprogname(argc > 0 ? argv[0] : "check_base64"); + for (i = 0; i < ntests; i++) { len = base64_decode(test_strings[i].encoded, buf, sizeof(buf)); buf[len] = '\0'; diff --git a/plugins/sudoers/regress/parser/check_digest.c b/plugins/sudoers/regress/parser/check_digest.c index 3dd329243..fbb4261b2 100644 --- a/plugins/sudoers/regress/parser/check_digest.c +++ b/plugins/sudoers/regress/parser/check_digest.c @@ -41,6 +41,7 @@ #include "sudo_compat.h" #include "sudo_fatal.h" #include "sudo_queue.h" +#include "sudo_util.h" #include "parse.h" __dso_public int main(int argc, char *argv[]); @@ -101,6 +102,8 @@ main(int argc, char *argv[]) size_t digest_len; int digest_type; + initprogname(argc > 0 ? argv[0] : "check_digest"); + for (digest_type = 0; digest_type < SUDO_DIGEST_INVALID; digest_type++) { for (i = 0; i < NUM_TESTS; i++) { digest = check_digest(digest_type, test_strings[i], diff --git a/plugins/sudoers/regress/parser/check_gentime.c b/plugins/sudoers/regress/parser/check_gentime.c index 6d7568086..3ad612e57 100644 --- a/plugins/sudoers/regress/parser/check_gentime.c +++ b/plugins/sudoers/regress/parser/check_gentime.c @@ -30,6 +30,7 @@ #define SUDO_ERROR_WRAP 0 #include "sudo_compat.h" +#include "sudo_util.h" #include "sudoers_debug.h" #include "parse.h" @@ -65,6 +66,8 @@ main(int argc, char *argv[]) int ntests, errors = 0; time_t result; + initprogname(argc > 0 ? argv[0] : "check_gentime"); + /* Do local time tests in Eastern Standard Time. */ putenv("TZ=EST5EST5"); tzset(); diff --git a/plugins/sudoers/regress/parser/check_hexchar.c b/plugins/sudoers/regress/parser/check_hexchar.c index 320d175f6..7aef3dc30 100644 --- a/plugins/sudoers/regress/parser/check_hexchar.c +++ b/plugins/sudoers/regress/parser/check_hexchar.c @@ -34,6 +34,7 @@ #define SUDO_ERROR_WRAP 0 #include "sudo_compat.h" +#include "sudo_util.h" int hexchar(const char *s); @@ -50,6 +51,8 @@ main(int argc, char *argv[]) struct hexchar_test *test_data; int i, ntests, result, errors = 0; + initprogname(argc > 0 ? argv[0] : "check_hexchar"); + /* Build up test data. */ ntests = 256 + 256 + 3; test_data = calloc(sizeof(*test_data), ntests);