From: Johannes Sixt <j.sixt@viscovery.net>
To: Frank Li <lznuaa@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH v3 2/3] git-core: Support retrieving passwords with GIT_ASKPASS
Date: Tue, 02 Mar 2010 13:17:22 +0100 [thread overview]
Message-ID: <4B8D01D2.9060406@viscovery.net> (raw)
In-Reply-To: <1267530657-4848-1-git-send-email-lznuaa@gmail.com>
Frank Li schrieb:
> + memset(&pass, 0, sizeof(pass));
> + pass.argv = args;
> + pass.out = -1;
> + pass.use_shell = 1;
I thought that the conclusion was to follow how openssh treats
SSH_ASKPASS, and it *does not* treat it as a command with arguments. Do
not set use_shell.
> + if (start_command(&pass)) {
> + error("could not run %s\n", askpass);
As I said, this error message is redundant. No big deal, though.
> + exit(1);
> + }
> +
> + strbuf_read(&buffer, pass.out, 20);
> + close(pass.out);
> + finish_command(&pass);
You must check for errors here as well. No error message is needed, either.
> +
> + for (i = 0; i < buffer.len; i++)
> + if (buffer.buf[i] == '\n' || buffer.buf[i] == '\r') {
> + buffer.buf[i] = '\0';
> + buffer.len = i;
> + }
I think you can shorten this loop to
strbuf_setlen(&buffer, strcspn(buffer.buf, "\r\n"));
-- Hannes
prev parent reply other threads:[~2010-03-02 12:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-02 11:50 [PATCH v3 2/3] git-core: Support retrieving passwords with GIT_ASKPASS Frank Li
2010-03-02 12:17 ` Johannes Sixt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B8D01D2.9060406@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=lznuaa@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).