summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2010-09-29 22:22:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-09-30 19:22:02 (GMT)
commit8713feb16dd6a472828bbdcf914a1c8f5c6810a2 (patch)
tree465aa54197d8f87734170e05e767fc20d7a9630c
parentdbda967684dfefd0ac3518f9805ccf9ded9af429 (diff)
downloadgit-8713feb16dd6a472828bbdcf914a1c8f5c6810a2.zip
git-8713feb16dd6a472828bbdcf914a1c8f5c6810a2.tar.gz
git-8713feb16dd6a472828bbdcf914a1c8f5c6810a2.tar.bz2
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>
-rw-r--r--connect.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/connect.c b/connect.c
index 3450cab..57dc20c 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;