[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getdelim doesn't set errno on failure?
From: |
Bruno Haible |
Subject: |
Re: getdelim doesn't set errno on failure? |
Date: |
Wed, 24 Aug 2005 13:58:20 +0200 |
User-agent: |
KMail/1.5 |
Oskar Liljeblad wrote:
> Here's what getdelim in Gnulib returns:
> >=0, errno undefined, feof (getc returned EOF, reached end of file)
> >=0, errno!=0, ferror (getc returned EOF, read failed)
Actually I think the glibc doc means that -1 is returned if EOF or read
failure occurs before the first character is read. If it occurs after
some non-empty string is already read, this non-empty string is returned.
> -1, errno!=0 (malloc failed, assuming malloc set errno)
> -1, errno!=0 (realloc failed, assuming realloc set
> errno)
You cannot assume that malloc() and realloc() set errno upon failure.
- In ISO C 99, the description of malloc() and realloc() does not mention
errno. Also, <errno.h> is not required to declare a macro 'ENOMEM'.
- Windows (mingw) malloc() and realloc() don't always set errno.
But on the other hand, malloc() and realloc() are free to modify errno
even when they succeed. (This happens e.g. on GNU/kFreeBSD, a glibc system.)
Bruno
- getdelim doesn't set errno on failure?, Oskar Liljeblad, 2005/08/23
- Re: getdelim doesn't set errno on failure?, Jim Meyering, 2005/08/23
- Re: getdelim doesn't set errno on failure?, Oskar Liljeblad, 2005/08/23
- Re: getdelim doesn't set errno on failure?,
Bruno Haible <=
- Re: getdelim doesn't set errno on failure?, Jim Meyering, 2005/08/24
- Re: getdelim doesn't set errno on failure?, Bruno Haible, 2005/08/24
- Re: getdelim doesn't set errno on failure?, Oskar Liljeblad, 2005/08/24
- Re: getdelim doesn't set errno on failure?, Jim Meyering, 2005/08/24
- Re: ISO C 99 versus POSIX 2001, Bruno Haible, 2005/08/24
- Re: ISO C 99 versus POSIX 2001, Paul Eggert, 2005/08/24
- Re: getdelim doesn't set errno on failure?, Oskar Liljeblad, 2005/08/24
- Re: getdelim doesn't set errno on failure?, Derek Price, 2005/08/31
- Re: getdelim doesn't set errno on failure?, Derek Price, 2005/08/31
Re: [bug-gnulib] getdelim doesn't set errno on failure?, Bruno Haible, 2005/08/23