I don't know if this is necessary or necessarily correct, but
it seems getdelim doesn't always set errno on failure (when it
returns -1).
>From what I can tell, the test below (needed < cur_len) is to
test for overflow.
Oskar Liljeblad ([EMAIL PROTECTED])
Index: getdelim.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/getdelim.c,v
retrieving revision 1.1
diff -u -p -r1.1 getdelim.c
--- getdelim.c 2 Aug 2005 09:33:30 -0000 1.1
+++ getdelim.c 23 Aug 2005 14:38:56 -0000
@@ -28,6 +28,11 @@
#include "getdelim.h"
+/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */
+#ifndef EOVERFLOW
+# define EOVERFLOW E2BIG
+#endif
+
#if !HAVE_FLOCKFILE
# undef flockfile
# define flockfile(x) ((void) 0)
@@ -86,6 +91,7 @@ getdelim (char **lineptr, size_t *n, int
if (needed < cur_len)
{
+ errno = EOVERFLOW;
result = -1;
goto unlock_return;
}
_______________________________________________
bug-gnulib mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnulib