Mercurial > hg > octave-nkf > gnulib-hg
changeset 9165:ef74805fd7e0
Getdelim touchup.
* lib/getdelim.c (getdelim): Don't bother to save/restore errno
around the funlockfile call, since funlockfile never sets errno.
Don't set errno upon failed realloc.
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Thu, 23 Aug 2007 08:33:16 +0000 |
parents | e945561759a5 |
children | 266a32af3c1a |
files | ChangeLog lib/getdelim.c |
diffstat | 2 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-08-23 Jim Meyering <jim@meyering.net> + + Getdelim touchup. + * lib/getdelim.c (getdelim): Don't bother to save/restore errno + around the funlockfile call, since funlockfile never sets errno. + Don't set errno upon failed realloc. + 2007-08-22 Eric Blake <ebb9@byu.net> Getline touchups.
--- a/lib/getdelim.c +++ b/lib/getdelim.c @@ -58,7 +58,6 @@ { ssize_t result; size_t cur_len = 0; - int e; /* Preserve errno across funlockfile. */ if (lineptr == NULL || n == NULL || fp == NULL) { @@ -75,7 +74,6 @@ if (*lineptr == NULL) { result = -1; - e = ENOMEM; goto unlock_return; } } @@ -88,7 +86,6 @@ if (i == EOF) { result = -1; - e = errno; break; } @@ -105,7 +102,7 @@ if (cur_len + 1 >= needed) { result = -1; - e = EOVERFLOW; + errno = EOVERFLOW; goto unlock_return; } @@ -113,7 +110,6 @@ if (new_lineptr == NULL) { result = -1; - e = ENOMEM; goto unlock_return; } @@ -131,8 +127,7 @@ result = cur_len ? cur_len : result; unlock_return: - funlockfile (fp); - if (result == -1) - errno = e; + funlockfile (fp); /* doesn't set errno */ + return result; }