diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-02-28 19:21:03 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-02-28 19:21:03 +0100 |
commit | 8b72726549be9e816ca8af0b9489948cc4fccb41 (patch) | |
tree | 445dc4ac0c074087cef16ca247a4f0e112d9cfa7 /sys/src/ape | |
parent | 8a903895a08c67fb4bb02fb21e2186a0e08b0513 (diff) |
ape: add PASS_MAX constant for getpass() to limits.h (from patch/ape-pass_max)
add PASS_MAX to limits.h for ape, and make getpass respect it. also increase the size of
the maximum passwords (we use long ones at work). Needed for native port of SVN (in progress).
Diffstat (limited to 'sys/src/ape')
-rw-r--r-- | sys/src/ape/lib/v/plan9/getpass.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/src/ape/lib/v/plan9/getpass.c b/sys/src/ape/lib/v/plan9/getpass.c index f8f6a8e89..1b8bbc325 100644 --- a/sys/src/ape/lib/v/plan9/getpass.c +++ b/sys/src/ape/lib/v/plan9/getpass.c @@ -2,6 +2,7 @@ #define _RESEARCH_SOURCE #include <stdio.h> #include <signal.h> +#include <limits.h> #include <libv.h> char * @@ -10,7 +11,7 @@ getpass(char *prompt) int c; char *p; FILE *fi; - static char pbuf[9]; + static char pbuf[PASS_MAX]; void (*sig)(int); if ((fi = fopen("/dev/cons", "r")) == NULL) @@ -28,7 +29,7 @@ getpass(char *prompt) else if (c == '\b') { if (p > pbuf) p--; - } else if (p < &pbuf[8]) + } else if (p < &pbuf[sizeof(pbuf)-1]) *p++ = c; *p = '\0'; |