diff options
author | Werner Koch <wk@gnupg.org> | 2021-03-04 16:52:03 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2021-03-04 16:59:21 +0100 |
commit | 089c9439674e8ecbc64f0ba924e6fb447bbc2b9d (patch) | |
tree | 6c72cea63c4a70ca614664c40ccaadb76d161bba /common/init.c | |
parent | common,w32: Refine the command line parsing for \ in quotes. (diff) | |
download | gnupg2-089c9439674e8ecbc64f0ba924e6fb447bbc2b9d.tar.xz gnupg2-089c9439674e8ecbc64f0ba924e6fb447bbc2b9d.zip |
common,w32: Implement globing of command line args.
* common/w32-misc.c [W32]: Include windows.h
(struct add_arg_s): New.
(add_arg): New.
(glob_arg): New.
(parse_cmdstring): Add arg argvflags and set it.
(w32_parse_commandline): Add arg r_itemsalloced. Add globing.
* common/init.c (prepare_w32_commandline): Mark glob created items as
leaked.
* common/t-w32-cmdline.c : Include windows.h
(test_all): Add simple glob test for Unix.
(main): Add manual test mode for Windows.
--
GnuPG-bug-id: 4398
Diffstat (limited to 'common/init.c')
-rw-r--r-- | common/init.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/common/init.c b/common/init.c index 06fd30956..ba20cd8d0 100644 --- a/common/init.c +++ b/common/init.c @@ -318,7 +318,7 @@ prepare_w32_commandline (int *r_argc, char ***r_argv) int argc; char **argv; const char *s; - int globing; + int i, globing, itemsalloced; s = gpgrt_strusage (95); globing = (s && *s == '1'); @@ -349,13 +349,18 @@ prepare_w32_commandline (int *r_argc, char ***r_argv) } gpgrt_annotate_leaked_object (cmdline); - argv = w32_parse_commandline (cmdline, globing, &argc); + argv = w32_parse_commandline (cmdline, globing, &argc, &itemsalloced); if (!argv) { log_error ("parsing command line failed: %s\n", "internal error"); return; /* Ooops. */ } gpgrt_annotate_leaked_object (argv); + if (itemsalloced) + { + for (i=0; i < argc; i++) + gpgrt_annotate_leaked_object (argv[i]); + } *r_argv = argv; *r_argc = argc; } |