Skip to content

Commit

Permalink
Make sure that git_getpass() never returns NULL
Browse files Browse the repository at this point in the history
The result of git_getpass() is used without checking for NULL, so let's
just die() instead of returning NULL.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
dscho authored and gitster committed Sep 30, 2010
1 parent dbda967 commit 8713feb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,12 @@ char *git_getpass(const char *prompt)
askpass = askpass_program;
if (!askpass)
askpass = getenv("SSH_ASKPASS");
if (!askpass || !(*askpass))
return getpass(prompt);
if (!askpass || !(*askpass)) {
char *result = getpass(prompt);
if (!result)
die_errno("Could not read password");
return result;
}

args[0] = askpass;
args[1] = prompt;
Expand Down

0 comments on commit 8713feb

Please sign in to comment.