Re: [PATCH] git-tag: don't use gpg's stdin, stdout when signing tags
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Feb 20, 2009, 17:56 UTC
- Message-ID
- <499EEEEA.2040600@kdbg.org>
- In-Reply-To
- <20090220113856.6612.qmail@0bbdb5719a4668.315fe32.mid.smarden.org>
Gerrit Pape schrieb:
Show 6 quoted lines
> memset(&gpg, 0, sizeof(gpg)); > gpg.argv = args; > - gpg.in = -1; > - gpg.out = -1; > + gpg.in = 0; > + gpg.out = 1;
I assume you mean with this that gpg should read from fd 0 and write to fd 1, IOW, it should use the standard channels. If I am right, then the memset above has initialized gpg as needed already. Then gpg.argv is the only thing you are setting up in struct child_process gpg; but in this case you can use a convenience function...
> args[0] = "gpg"; > args[1] = "-bsau"; > args[2] = signingkey; > - args[3] = NULL;
...
> + args[3] = "-o"; > + args[4] = signpath; > + args[5] = unsignpath; > + args[6] = NULL;
...
> + if (run_command(&gpg)) {... here (note: no struct child_process needed):
if (run_command_v_opt(args, 0)) {(Just in case this patch is required...)
-- Hannes