diff options
Diffstat (limited to 'prompt.c')
-rw-r--r-- | prompt.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -6,7 +6,7 @@ static char *do_askpass(const char *cmd, const char *prompt) { - struct child_process pass; + struct child_process pass = CHILD_PROCESS_INIT; const char *args[3]; static struct strbuf buffer = STRBUF_INIT; int err = 0; @@ -15,13 +15,13 @@ static char *do_askpass(const char *cmd, const char *prompt) args[1] = prompt; args[2] = NULL; - memset(&pass, 0, sizeof(pass)); pass.argv = args; pass.out = -1; if (start_command(&pass)) return NULL; + strbuf_reset(&buffer); if (strbuf_read(&buffer, pass.out, 20) < 0) err = 1; @@ -38,7 +38,7 @@ static char *do_askpass(const char *cmd, const char *prompt) strbuf_setlen(&buffer, strcspn(buffer.buf, "\r\n")); - return strbuf_detach(&buffer, NULL); + return buffer.buf; } char *git_prompt(const char *prompt, int flags) |