On the manpage of getdelim:
If *lineptr is NULL, then getline() will allocate a buffer for storing
the line, which should be freed by the user program. (In this case,
the value in *n is ignored.)
I also took a look at the source code of the latest glibc, which
conforms to the above description. So I have committed the attached
patch to fix our getdelim, which otherwise would return -1 when
*lineptr is NULL and *n is not zero.
Regards,
Jie
* src/lib/getdelim.c (getdelim): Don't report error if *lineptr
is NULL but *n is not zero.
Index: src/lib/getdelim.c
===================================================================
--- src/lib/getdelim.c (revision 1972)
+++ src/lib/getdelim.c (working copy)
@@ -39,7 +39,7 @@ getdelim (char **lineptr, size_t *n, int
int c;
size_t len = 0;
- if (!lineptr || !n || (!*lineptr && *n))
+ if (!lineptr || !n)
return -1;
/* allocate initial buffer */
------------------------------------------------------------------------------
Storage Efficiency Calculator
This modeling tool is based on patent-pending intellectual property that
has been used successfully in hundreds of IBM storage optimization engage-
ments, worldwide. Store less, Store more with what you own, Move data to
the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/
_______________________________________________
UrJTAG-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/urjtag-development