summaryrefslogtreecommitdiff
path: root/libc/stdio
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-09-30 04:55:22 +0000
committerEric Andersen <andersen@codepoet.org>2001-09-30 04:55:22 +0000
commitdb20984e9baf42ce9b3e8d0de42d2efe21a05b13 (patch)
treefa09c6fe7c6c575113113108885ce6567a2db222 /libc/stdio
parentf24155cd29c6f30158d5c3df03c63b0c9ca30775 (diff)
Fix nasty behavior difference from glibc -- also fixes getline()
-Erik
Diffstat (limited to 'libc/stdio')
-rw-r--r--libc/stdio/getdelim.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libc/stdio/getdelim.c b/libc/stdio/getdelim.c
index 65d5738a1..7cc1f8e84 100644
--- a/libc/stdio/getdelim.c
+++ b/libc/stdio/getdelim.c
@@ -41,13 +41,12 @@ ssize_t getdelim(char **linebuf, size_t *linebufsz, int delimiter, FILE *file)
int ch;
int idx = 0;
- if ((file == NULL || linebuf==NULL || *linebuf == NULL || *linebufsz == 0)
- && !(*linebuf == NULL && *linebufsz ==0 )) {
+ if (file == NULL || linebuf==NULL || linebufsz == NULL) {
__set_errno(EINVAL);
return -1;
}
- if (*linebuf == NULL && *linebufsz == 0){
+ if (*linebuf == NULL || *linebufsz < 2) {
*linebuf = malloc(GROWBY);
if (!*linebuf) {
__set_errno(ENOMEM);