summaryrefslogtreecommitdiff
path: root/libc/stdio
diff options
context:
space:
mode:
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);