summaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2010-09-29 23:22:32 +0100
committerJunio C Hamano <gitster@pobox.com>2010-09-30 12:22:02 -0700
commit8713feb16dd6a472828bbdcf914a1c8f5c6810a2 (patch)
tree465aa54197d8f87734170e05e767fc20d7a9630c /connect.c
parentdbda967684dfefd0ac3518f9805ccf9ded9af429 (diff)
downloadgit-8713feb16dd6a472828bbdcf914a1c8f5c6810a2.tar.gz
Make sure that git_getpass() never returns NULL
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>
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/connect.c b/connect.c
index 3450cabd0e..57dc20c43c 100644
--- a/connect.c
+++ b/connect.c
@@ -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;