On Tuesday, August 23, 2005 at 17:59, Jim Meyering wrote: > Oskar Liljeblad <[EMAIL PROTECTED]> wrote: > > 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. > > Right. > How about using ENOMEM instead?
Yes, that would be useful. It is hard as it is to handle errors from getline. Also the documentation from GNU libc seems wrong: If an error occurs or end of file is reached without any bytes read, `getline' returns `-1'. Here's what getdelim in Gnulib returns: -1, errno=EINVAL (an argument is NULL) -1, errno!=0 (malloc failed, assuming malloc set errno) >=0, errno undefined, feof (getc returned EOF, reached end of file) >=0, errno!=0, ferror (getc returned EOF, read failed) -1, errno undefined (arithmetic overflow) -1, errno!=0 (realloc failed, assuming realloc set errno) So getline/getdelim only returns -1 on invalid arguments or an out of memory condition, never on I/O errors or EOF! Or did I miss something? Regards, Oskar Liljeblad ([EMAIL PROTECTED]) _______________________________________________ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib