Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
wincred: accept CRLF on stdin to simplify console usage
author
Karsten Blees
<blees@dcon.de>
Wed, 9 Jan 2013 11:49:26 +0000
(12:49 +0100)
committer
Erik Faye-Lund
<kusmabite@gmail.com>
Tue, 26 Feb 2013 16:42:24 +0000
(17:42 +0100)
The windows credential helper currently only accepts LF on stdin, but bash
and cmd.exe both send CRLF. This prevents interactive use in the console.
Change the stdin parser to optionally accept CRLF.
Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
contrib/credential/wincred/git-credential-wincred.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
4dac067
)
diff --git
a/contrib/credential/wincred/git-credential-wincred.c
b/contrib/credential/wincred/git-credential-wincred.c
index cbaec5f24b9c2b4a1fb1b25af57a826a053da037..94d7140f026a126e754dd922f6190c39e72d5add 100644
(file)
--- a/
contrib/credential/wincred/git-credential-wincred.c
+++ b/
contrib/credential/wincred/git-credential-wincred.c
@@
-284,10
+284,13
@@
static void read_credential(void)
while (fgets(buf, sizeof(buf), stdin)) {
char *v;
+ int len = strlen(buf);
+ /* strip trailing CR / LF */
+ while (len && strchr("\r\n", buf[len - 1]))
+ buf[--len] = 0;
- if (!
strcmp(buf, "\n")
)
+ if (!
*buf
)
break;
- buf[strlen(buf)-1] = '\0';
v = strchr(buf, '=');
if (!v)